Bug 1706917 Comment 9 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

[VideoCodec::maxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_codec.h#114) -> This is set:
* In [SimulcastEncoderAdapter::PopulateStreamCodec](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/media/engine/simulcast_encoder_adapter.cc#583), based on [SpatialLayer::maxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/spatial_layer.h#24), which is set in (only VP9 cases?):
    * For VP9, [ConfigureSvcNormalVideo](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp9/svc_config.cc#111,117-118), based on the resolution in [SpatialLayer](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/spatial_layer.h#20-21) (but not [SpatialLayer::maxFramerate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/spatial_layer.h#22)? Weird.)
    * For VP9, [ConfigureSvcScreenSharing](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp9/svc_config.cc#30,51-52), based on some static config
    * [VideoCodecInitializer::VideoEncoderConfigToVideoCodec](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/video_codec_initializer.cc#112), based on [VideoStream::max_bitrate_bps](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_encoder_config.h#46), which is set by [VideoStreamEncoder::ReconfigureEncoder](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_stream_encoder.cc#635,637-638,643,871-873) based on:
        * In the VP9 case, [SvcRateAllocator::GetMaxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp9/svc_rate_allocator.cc#385,391-392,396-397,400), which is in turn based either on a [SpatialLayer::maxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/spatial_layer.h#24) or a [VideoCodec::maxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_codec.h#114) (lots of loopy dependencies here...)
        * [VideoStreamEncoder::encoder_bitrate_limits_](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_stream_encoder.h#314), which is set by [VideoStreamEncoder::ReconfigureEncoder](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_stream_encoder.cc#613-615) based on the return of [VideoEncoder::EncoderInfo::GetEncoderBitrateLimitsForResolution](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_encoder.cc#216,218-219), which is based on [VideoEncoder::EncoderInfo::resolution_bitrate_limits](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_encoder.h#244), which is set by [LibvpxVp8Encoder::GetEncoderInfo](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc#1250), which is based on [LibvpxVp8Encoder::resolution_bitrate_limits_](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.h#117), which is set by [LibvpxVp8Encoder::LibvpxVp8Encoder](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc#299), based on [VP8Encoder::resolution_bitrate_limits](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp8/include/vp8.h#37), which does not appear to be set anywhere

* In [VideoCodecInitializer::VideoEncoderConfigToVideoCodec](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/video_codec_initializer.cc#53,125,133-135,137-138), based on either resolution or [VideoStream::max_bitrate_bps](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_encoder_config.h#46) (same as above)
* To 300 in [CreateDecoderVideoCodec](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_receive_stream.cc#140) (also in [video_receive_stream2.cc](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_receive_stream2.cc#149))
* To one bit per pixel (and at least startBitrate) in [VideoStreamEncoder::ReconfigureEncoder](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_stream_encoder.cc#735-738,742)
[VideoCodec::maxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_codec.h#114) -> This is set:
* In [SimulcastEncoderAdapter::PopulateStreamCodec](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/media/engine/simulcast_encoder_adapter.cc#583), based on [SpatialLayer::maxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/spatial_layer.h#24), which is set in:
    * For VP9, [ConfigureSvcNormalVideo](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp9/svc_config.cc#111,117-118), based on the resolution in [SpatialLayer](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/spatial_layer.h#20-21) (but not [SpatialLayer::maxFramerate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/spatial_layer.h#22)? Weird.)
    * For VP9, [ConfigureSvcScreenSharing](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp9/svc_config.cc#30,51-52), based on some static config
    * [VideoCodecInitializer::VideoEncoderConfigToVideoCodec](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/video_codec_initializer.cc#112), based on [VideoStream::max_bitrate_bps](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_encoder_config.h#46), which is set by:
        * [SelectBitrates](https://searchfox.org/mozilla-central/rev/25997ce8267ec9e3ea4b727e0973bd9ef02bba79/dom/media/webrtc/libwebrtcglue/VideoStreamFactory.cpp#78,84,91,100) inside our conduit code, based on our config.
        * [VideoStreamEncoder::ReconfigureEncoder](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_stream_encoder.cc#635,637-638,643,871-873) based on:
            * In the VP9 case, [SvcRateAllocator::GetMaxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp9/svc_rate_allocator.cc#385,391-392,396-397,400), which is in turn based either on a [SpatialLayer::maxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/spatial_layer.h#24) or a [VideoCodec::maxBitrate](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_codec.h#114) (lots of loopy dependencies here...)
            * [VideoStreamEncoder::encoder_bitrate_limits_](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_stream_encoder.h#314), which is set by [VideoStreamEncoder::ReconfigureEncoder](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_stream_encoder.cc#613-615) based on the return of [VideoEncoder::EncoderInfo::GetEncoderBitrateLimitsForResolution](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_encoder.cc#216,218-219), which is based on [VideoEncoder::EncoderInfo::resolution_bitrate_limits](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_encoder.h#244), which is set by [LibvpxVp8Encoder::GetEncoderInfo](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc#1250), which is based on [LibvpxVp8Encoder::resolution_bitrate_limits_](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.h#117), which is set by [LibvpxVp8Encoder::LibvpxVp8Encoder](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc#299), based on [VP8Encoder::resolution_bitrate_limits](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/codecs/vp8/include/vp8.h#37), which does not appear to be set anywhere

* In [VideoCodecInitializer::VideoEncoderConfigToVideoCodec](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/modules/video_coding/video_codec_initializer.cc#53,125,133-135,137-138), based on either resolution or [VideoStream::max_bitrate_bps](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/api/video_codecs/video_encoder_config.h#46) (same as above)
* To 300 in [CreateDecoderVideoCodec](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_receive_stream.cc#140) (also in [video_receive_stream2.cc](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_receive_stream2.cc#149))
* To one bit per pixel (and at least startBitrate) in [VideoStreamEncoder::ReconfigureEncoder](https://searchfox.org/mozilla-central/rev/a48e21143960b383004afa9ff9411c5cf6d5a958/third_party/libwebrtc/video/video_stream_encoder.cc#735-738,742)

Back to Bug 1706917 Comment 9