Repository navigation
feat: build WebRTC with H.265 - #346
Merged
Merged
Conversation
WebRTC was built without H.265 (rtc_use_h265 follows proprietary_codecs, which is off), so a call could not carry it even with an encoder and a decoder for it: no H.265 packetization, no depacketizer (WebRTC creates none and drops the stream) and no H.265 negotiation. It is now built with rtc_use_h265=true, and the JNI code with RTC_ENABLE_H265 to match. WebRTC has no H.265 codec of its own and none is added, so H.265 is offered only by a factory that brings one. A compiled WebRTC is used only if it was built with the current GN args, which are recorded next to the library in the build tree and the install directory. A build without the record or with other args is built again, and the stale installed library is removed so nothing links it meanwhile. Before, any existing library was taken as it was, so a change to the args never reached a machine that had built WebRTC once. The record is written only when gn and ninja succeed. Java encoders get the QP of H.265 frames parsed, and the H.264 quality scaling thresholds for H.265, as WebRTC's Android wrapper has them. A new test sends a call through a Java H.265 encoder and decoder, whose frames are wrapped in H.265 NAL units.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WebRTC was built without H.265 (
rtc_use_h265followsproprietary_codecs, which is off), so a call could not carry H.265 even with an encoder and decoder for it: there was no H.265 RTP packetization, no depacketizer (WebRTC creates none and drops the stream) and no H.265 negotiation. This builds WebRTC with it. It is the groundwork for hardware H.265 in calls on Windows, macOS and Linux, which the hardware codec factories add next.rtc_use_h265=truein the GN args, andRTC_ENABLE_H265for the JNI code, so that it is compiled against the same declarations. None of the headers the JNI code includes changes a struct layout with it.webrtc.lib/libwebrtc.awas taken as it was, so a change to the args never reached a machine that had built WebRTC once. The record is written only when gn and ninja succeed. CI's WebRTC cache key already hashes thisCMakeLists.txt, so CI rebuilds on its own.VideoEncoderWrapper(Java encoders) parses the QP of H.265 frames and uses the H.264 quality-scaling thresholds for H.265, as WebRTC's own Android wrapper does (bugs.webrtc.org/13485).Testing
rtc_use_h265touches is recompiled; about 5 minutes here). The new library has the H.265 packetizer, depacketizer and bitstream parser, and the next configure reuses it.VideoCodecFactoryTests.h265CallRoundTripsis new: a call between two local peer connections negotiates H.265 through a Java encoder and decoder, which wrap the test payload in H.265 NAL units (VPS, SPS, PPS and an IDR slice). Every frame received is one that was sent. Without H.265 in WebRTC the receiver has no depacketizer for the stream and nothing arrives.webrtcandwebrtc-java-mediapass against the rebuilt library.Not verified
The rebuild ran on Windows x64 only; CI rebuilds WebRTC for the other six platforms. No real H.265 encoder or decoder is involved yet: the test checks negotiation, packetization and depacketization with a synthetic bitstream.