Chromium Code Reviews| Index: webrtc/modules/video_coding/video_coding_impl.cc |
| diff --git a/webrtc/modules/video_coding/video_coding_impl.cc b/webrtc/modules/video_coding/video_coding_impl.cc |
| index 2f709b610c1453a6e8fc9415042189a9f03ddae2..f0c596c1e139bc740e0bf0275dfcb7a6650582aa 100644 |
| --- a/webrtc/modules/video_coding/video_coding_impl.cc |
| +++ b/webrtc/modules/video_coding/video_coding_impl.cc |
| @@ -11,10 +11,14 @@ |
| #include "webrtc/modules/video_coding/video_coding_impl.h" |
| #include <algorithm> |
| +#include <utility> |
| #include "webrtc/common_types.h" |
| +#include "webrtc/common_video/include/video_bitrate_allocator.h" |
| #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| #include "webrtc/base/criticalsection.h" |
| +#include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" |
| +#include "webrtc/modules/video_coding/include/video_codec_initializer.h" |
| #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
| #include "webrtc/modules/video_coding/encoded_frame.h" |
| #include "webrtc/modules/video_coding/jitter_buffer.h" |
| @@ -104,6 +108,16 @@ class VideoCodingModuleImpl : public VideoCodingModule { |
| int32_t RegisterSendCodec(const VideoCodec* sendCodec, |
| uint32_t numberOfCores, |
| uint32_t maxPayloadSize) override { |
| + if (sendCodec != nullptr && sendCodec->codecType == kVideoCodecVP8) { |
| + VideoCodec vp8_codec = *sendCodec; |
| + std::unique_ptr<TemporalLayersFactory> tl_factory( |
| + new TemporalLayersFactory()); |
| + vp8_codec.VP8()->tl_factory = tl_factory.get(); |
| + rate_allocator_ = VideoCodecInitializer::GetBitrateAllocator( |
| + vp8_codec, std::move(tl_factory)); |
| + return sender_.RegisterSendCodec(&vp8_codec, numberOfCores, |
| + maxPayloadSize); |
|
stefan-webrtc
2016/11/09 11:58:12
I find it a bit difficult to understand lifetime o
sprang_webrtc
2016/11/09 12:26:18
The TemporalLayersFactory is owned by the BitrateA
stefan-webrtc
2016/11/09 12:40:26
Does it make more sense to let the codec own the a
|
| + } |
| return sender_.RegisterSendCodec(sendCodec, numberOfCores, maxPayloadSize); |
| } |
| @@ -126,7 +140,8 @@ class VideoCodingModuleImpl : public VideoCodingModule { |
| int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s. |
| uint8_t lossRate, |
| int64_t rtt) override { |
| - return sender_.SetChannelParameters(target_bitrate, lossRate, rtt); |
| + return sender_.SetChannelParameters(target_bitrate, lossRate, rtt, |
| + rate_allocator_.get()); |
| } |
| int32_t RegisterProtectionCallback( |
| @@ -256,6 +271,7 @@ class VideoCodingModuleImpl : public VideoCodingModule { |
| private: |
| EncodedImageCallbackWrapper post_encode_callback_; |
| vcm::VideoSender sender_; |
| + std::unique_ptr<VideoBitrateAllocator> rate_allocator_; |
| vcm::VideoReceiver receiver_; |
| }; |
| } // namespace |