morgan pushed to branch tor-browser-128.8.0esr-14.5-1 at The Tor Project / 
Applications / Tor Browser


Commits:
4224ae27 by John Lin at 2025-03-10T15:04:22+01:00
Bug 1924070 - modify H.264 extradata to match sample conversion code. 
r=media-playback-reviewers,alwu

In AVC stream, NAL unit is represented with the length of unit data
(NALUnitLength) followed by the actual unit data(NALUnit). The NALUnitLength
field can be 1-4 bytes long and the size can be derived from the
'lengthSizeMinusOne' value recorded in extradata.
H264ChangeMonitor.CheckForChange() reformats all input samples so that
NALUnitLength will always be 4 bytes long while the original extradata is
used during decoder creation earlier, so decoder won't be able to correctly
parse converted samples if extradata is not modified accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D239547
- - - - -


1 changed file:

- dom/media/platforms/wrappers/MediaChangeMonitor.cpp


Changes:

=====================================
dom/media/platforms/wrappers/MediaChangeMonitor.cpp
=====================================
@@ -42,6 +42,14 @@ class H264ChangeMonitor : public 
MediaChangeMonitor::CodecChangeMonitor {
       : mCurrentConfig(aInfo), mFullParsing(aFullParsing) {
     if (CanBeInstantiated()) {
       UpdateConfigFromExtraData(aInfo.mExtraData);
+      auto avcc = AVCCConfig::Parse(mCurrentConfig.mExtraData);
+      if (avcc.isOk() && avcc.unwrap().NALUSize() != 4) {
+        // `CheckForChange()` will use `AnnexB::ConvertSampleToAVCC()` to 
change
+        // NAL units into 4-byte.
+        // `AVCDecoderConfigurationRecord.lengthSizeMinusOne` in the config
+        // should be modified too.
+        mCurrentConfig.mExtraData->ReplaceElementAt(4, 0xfc | 3);
+      }
     }
   }
 



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/4224ae27b31be0af1713890d2738d5821f59c8c2

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/4224ae27b31be0af1713890d2738d5821f59c8c2
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to