Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: webrtc/modules/video_coding/video_coding_impl.cc

Issue 2575473004: Create VideoReceiver with external VCMTiming object. (Closed)
Patch Set: Feedback Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/video_coding/video_coding_impl.h" 11 #include "webrtc/modules/video_coding/video_coding_impl.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <utility> 14 #include <utility>
15 15
16 #include "webrtc/base/criticalsection.h"
16 #include "webrtc/common_types.h" 17 #include "webrtc/common_types.h"
17 #include "webrtc/common_video/include/video_bitrate_allocator.h" 18 #include "webrtc/common_video/include/video_bitrate_allocator.h"
18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
19 #include "webrtc/base/criticalsection.h"
20 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" 20 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
21 #include "webrtc/modules/video_coding/encoded_frame.h"
21 #include "webrtc/modules/video_coding/include/video_codec_initializer.h" 22 #include "webrtc/modules/video_coding/include/video_codec_initializer.h"
22 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 23 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
23 #include "webrtc/modules/video_coding/encoded_frame.h"
24 #include "webrtc/modules/video_coding/jitter_buffer.h" 24 #include "webrtc/modules/video_coding/jitter_buffer.h"
25 #include "webrtc/modules/video_coding/packet.h" 25 #include "webrtc/modules/video_coding/packet.h"
26 #include "webrtc/modules/video_coding/timing.h"
26 #include "webrtc/system_wrappers/include/clock.h" 27 #include "webrtc/system_wrappers/include/clock.h"
27 28
28 namespace webrtc { 29 namespace webrtc {
29 namespace vcm { 30 namespace vcm {
30 31
31 int64_t VCMProcessTimer::Period() const { 32 int64_t VCMProcessTimer::Period() const {
32 return _periodMs; 33 return _periodMs;
33 } 34 }
34 35
35 int64_t VCMProcessTimer::TimeUntilProcess() const { 36 int64_t VCMProcessTimer::TimeUntilProcess() const {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 class VideoCodingModuleImpl : public VideoCodingModule { 79 class VideoCodingModuleImpl : public VideoCodingModule {
79 public: 80 public:
80 VideoCodingModuleImpl(Clock* clock, 81 VideoCodingModuleImpl(Clock* clock,
81 EventFactory* event_factory, 82 EventFactory* event_factory,
82 NackSender* nack_sender, 83 NackSender* nack_sender,
83 KeyFrameRequestSender* keyframe_request_sender, 84 KeyFrameRequestSender* keyframe_request_sender,
84 EncodedImageCallback* pre_decode_image_callback) 85 EncodedImageCallback* pre_decode_image_callback)
85 : VideoCodingModule(), 86 : VideoCodingModule(),
86 sender_(clock, &post_encode_callback_, nullptr), 87 sender_(clock, &post_encode_callback_, nullptr),
88 timing_(new VCMTiming(clock)),
87 receiver_(clock, 89 receiver_(clock,
88 event_factory, 90 event_factory,
89 pre_decode_image_callback, 91 pre_decode_image_callback,
92 timing_.get(),
90 nack_sender, 93 nack_sender,
91 keyframe_request_sender) {} 94 keyframe_request_sender) {}
92 95
93 virtual ~VideoCodingModuleImpl() {} 96 virtual ~VideoCodingModuleImpl() {}
94 97
95 int64_t TimeUntilNextProcess() override { 98 int64_t TimeUntilNextProcess() override {
96 int64_t sender_time = sender_.TimeUntilNextProcess(); 99 int64_t sender_time = sender_.TimeUntilNextProcess();
97 int64_t receiver_time = receiver_.TimeUntilNextProcess(); 100 int64_t receiver_time = receiver_.TimeUntilNextProcess();
98 assert(sender_time >= 0); 101 assert(sender_time >= 0);
99 assert(receiver_time >= 0); 102 assert(receiver_time >= 0);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 EncodedImageCallback* observer) override { 273 EncodedImageCallback* observer) override {
271 post_encode_callback_.Register(observer); 274 post_encode_callback_.Register(observer);
272 } 275 }
273 276
274 void TriggerDecoderShutdown() override { receiver_.TriggerDecoderShutdown(); } 277 void TriggerDecoderShutdown() override { receiver_.TriggerDecoderShutdown(); }
275 278
276 private: 279 private:
277 EncodedImageCallbackWrapper post_encode_callback_; 280 EncodedImageCallbackWrapper post_encode_callback_;
278 vcm::VideoSender sender_; 281 vcm::VideoSender sender_;
279 std::unique_ptr<VideoBitrateAllocator> rate_allocator_; 282 std::unique_ptr<VideoBitrateAllocator> rate_allocator_;
283 std::unique_ptr<VCMTiming> timing_;
280 vcm::VideoReceiver receiver_; 284 vcm::VideoReceiver receiver_;
281 }; 285 };
282 } // namespace 286 } // namespace
283 287
284 void VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec) { 288 void VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec) {
285 VCMCodecDataBase::Codec(codecType, codec); 289 VCMCodecDataBase::Codec(codecType, codec);
286 } 290 }
287 291
288 // Create method for the new jitter buffer. 292 // Create method for the new jitter buffer.
289 VideoCodingModule* VideoCodingModule::Create( 293 VideoCodingModule* VideoCodingModule::Create(
(...skipping 22 matching lines...) Expand all
312 EventFactory* event_factory, 316 EventFactory* event_factory,
313 NackSender* nack_sender, 317 NackSender* nack_sender,
314 KeyFrameRequestSender* keyframe_request_sender) { 318 KeyFrameRequestSender* keyframe_request_sender) {
315 assert(clock); 319 assert(clock);
316 assert(event_factory); 320 assert(event_factory);
317 return new VideoCodingModuleImpl(clock, event_factory, nack_sender, 321 return new VideoCodingModuleImpl(clock, event_factory, nack_sender,
318 keyframe_request_sender, nullptr); 322 keyframe_request_sender, nullptr);
319 } 323 }
320 324
321 } // namespace webrtc 325 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698