[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-128.8.0esr-14.5-1] Bug 1924070 - modify H.264 extradata to match sample conversion code....



Title: GitLab

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:

Changes:

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

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx