tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit b7d5495e2cfe76ed6307941419eee56ac3cf5b47
parent 6f0fc61cf655588ebf495934b6d5d527b9af2ab2
Author: Alastor Wu <alwu@mozilla.com>
Date:   Fri, 17 Oct 2025 18:28:12 +0000

Bug 1967475 - part1 : only set IDR frame as keyframe for H264 on MacOS. r=media-playback-reviewers,jolin

The Apple VideoToolbox H.264 decoder could return a bad data error
if a non-IDR I-frame is provided as the first sample to the decoder
after seeking. Therefore, only IDR frames should be marked as key
frames.

Differential Revision: https://phabricator.services.mozilla.com/D268192

Diffstat:
Mdom/media/mp4/MP4Demuxer.cpp | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dom/media/mp4/MP4Demuxer.cpp b/dom/media/mp4/MP4Demuxer.cpp @@ -418,8 +418,14 @@ MP4TrackDemuxer::GetNextSample() { case H264::FrameType::I_FRAME_IDR: case H264::FrameType::I_FRAME_OTHER: case H264::FrameType::OTHER: { - bool keyframe = type == H264::FrameType::I_FRAME_OTHER || - type == H264::FrameType::I_FRAME_IDR; + bool keyframe = type == H264::FrameType::I_FRAME_IDR; +#ifndef MOZ_APPLEMEDIA + // The Apple VideoToolbox H.264 decoder could return a bad data error + // if a non-IDR I-frame is provided as the first sample to the decoder + // after seeking. Therefore, only IDR frames should be marked as key + // frames. + keyframe = keyframe || type == H264::FrameType::I_FRAME_OTHER; +#endif if (sample->mKeyframe != keyframe) { NS_WARNING(nsPrintfCString("Frame incorrectly marked as %skeyframe " "@ pts:%" PRId64 " dur:%" PRId64