Bug 1843113 - Vendor libwebrtc from 6cf12bbe32

Upstream commit: https://webrtc.googlesource.com/src/+/6cf12bbe327f70652f00c6ac1b0af34085a82719
    Fetch encoded QP before releasing output buffer

    Before this change we first released output frame buffer in the code path which prepends config buffer to a keyframe and then called getOutputFormat(index). getOutputFormat(index) throws an exception if index points to a released buffer. This change rearranges calls such that getOutputFormat(index) always executed before releaseOutputBuffer(index).

    Bug: webrtc:15015
    Change-Id: Ia64f5d8e7483aeeb316d1a71c0cb79233f4bbee9
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301364
    Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
    Reviewed-by: Philip Eliasson <philipel@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#39874}
This commit is contained in:
Michael Froman 2023-07-14 10:11:45 -05:00
Родитель 7ea1844832
Коммит 1c45ffcdcd
3 изменённых файлов: 17 добавлений и 9 удалений

3
third_party/libwebrtc/README.moz-ff-commit поставляемый
Просмотреть файл

@ -23262,3 +23262,6 @@ b812b7a86b
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
ea1502accb
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
6cf12bbe32

2
third_party/libwebrtc/README.mozilla поставляемый
Просмотреть файл

@ -15530,3 +15530,5 @@ libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T15:07:58.988047.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T15:09:58.627613.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T15:11:32.743241.

Просмотреть файл

@ -606,6 +606,15 @@ class HardwareVideoEncoder implements VideoEncoder {
Logging.d(TAG, "Sync frame generated");
}
// Extract QP before releasing output buffer.
Integer qp = null;
if (isEncodingStatisticsEnabled) {
MediaFormat format = codec.getOutputFormat(index);
if (format != null && format.containsKey(MediaFormat.KEY_VIDEO_QP_AVERAGE)) {
qp = format.getInteger(MediaFormat.KEY_VIDEO_QP_AVERAGE);
}
}
final ByteBuffer frameBuffer;
final Runnable releaseCallback;
if (isKeyFrame && configBuffer != null) {
@ -639,15 +648,9 @@ class HardwareVideoEncoder implements VideoEncoder {
: EncodedImage.FrameType.VideoFrameDelta;
EncodedImage.Builder builder = outputBuilders.poll();
builder.setBuffer(frameBuffer, releaseCallback).setFrameType(frameType);
if (isEncodingStatisticsEnabled) {
MediaFormat format = codec.getOutputFormat(index);
if (format != null && format.containsKey(MediaFormat.KEY_VIDEO_QP_AVERAGE)) {
int qp = format.getInteger(MediaFormat.KEY_VIDEO_QP_AVERAGE);
builder.setQp(qp);
}
}
builder.setBuffer(frameBuffer, releaseCallback);
builder.setFrameType(frameType);
builder.setQp(qp);
EncodedImage encodedImage = builder.createEncodedImage();
// TODO(mellem): Set codec-specific info.