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

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

Issue 1778503002: Experiment for the nack module. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added histogram to BUILD.gn. Created 4 years, 9 months 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
« no previous file with comments | « webrtc/modules/video_coding/video_coding_impl.cc ('k') | webrtc/video/video_receive_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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/base/checks.h" 11 #include "webrtc/base/checks.h"
12 #include "webrtc/base/logging.h" 12 #include "webrtc/base/logging.h"
13 #include "webrtc/base/trace_event.h" 13 #include "webrtc/base/trace_event.h"
14 #include "webrtc/common_types.h" 14 #include "webrtc/common_types.h"
15 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 15 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
16 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 16 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
17 #include "webrtc/modules/video_coding/encoded_frame.h" 17 #include "webrtc/modules/video_coding/encoded_frame.h"
18 #include "webrtc/modules/video_coding/jitter_buffer.h" 18 #include "webrtc/modules/video_coding/jitter_buffer.h"
19 #include "webrtc/modules/video_coding/packet.h" 19 #include "webrtc/modules/video_coding/packet.h"
20 #include "webrtc/modules/video_coding/video_coding_impl.h" 20 #include "webrtc/modules/video_coding/video_coding_impl.h"
21 #include "webrtc/system_wrappers/include/clock.h" 21 #include "webrtc/system_wrappers/include/clock.h"
22 22
23 // #define DEBUG_DECODER_BIT_STREAM 23 // #define DEBUG_DECODER_BIT_STREAM
24 24
25 namespace webrtc { 25 namespace webrtc {
26 namespace vcm { 26 namespace vcm {
27 27
28 VideoReceiver::VideoReceiver(Clock* clock, EventFactory* event_factory) 28 VideoReceiver::VideoReceiver(Clock* clock,
29 EventFactory* event_factory,
30 NackSender* nack_sender,
31 KeyFrameRequestSender* keyframe_request_sender)
29 : clock_(clock), 32 : clock_(clock),
30 process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), 33 process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
31 _receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()), 34 _receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
32 _timing(clock_), 35 _timing(clock_),
33 _receiver(&_timing, clock_, event_factory), 36 _receiver(&_timing,
37 clock_,
38 event_factory,
39 nack_sender,
40 keyframe_request_sender),
34 _decodedFrameCallback(&_timing, clock_), 41 _decodedFrameCallback(&_timing, clock_),
35 _frameTypeCallback(NULL), 42 _frameTypeCallback(NULL),
36 _receiveStatsCallback(NULL), 43 _receiveStatsCallback(NULL),
37 _decoderTimingCallback(NULL), 44 _decoderTimingCallback(NULL),
38 _packetRequestCallback(NULL), 45 _packetRequestCallback(NULL),
39 render_buffer_callback_(NULL), 46 render_buffer_callback_(NULL),
40 _decoder(NULL), 47 _decoder(NULL),
41 #ifdef DEBUG_DECODER_BIT_STREAM 48 #ifdef DEBUG_DECODER_BIT_STREAM
42 _bitStreamBeforeDecoder(NULL), 49 _bitStreamBeforeDecoder(NULL),
43 #endif 50 #endif
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 _keyRequestTimer.Processed(); 110 _keyRequestTimer.Processed();
104 bool request_key_frame = false; 111 bool request_key_frame = false;
105 { 112 {
106 CriticalSectionScoped cs(process_crit_sect_.get()); 113 CriticalSectionScoped cs(process_crit_sect_.get());
107 request_key_frame = _scheduleKeyRequest && _frameTypeCallback != NULL; 114 request_key_frame = _scheduleKeyRequest && _frameTypeCallback != NULL;
108 } 115 }
109 if (request_key_frame) 116 if (request_key_frame)
110 RequestKeyFrame(); 117 RequestKeyFrame();
111 } 118 }
112 119
120 if (_receiver.TimeUntilNextProcess() == 0) {
121 _receiver.Process();
122 }
123
113 // Packet retransmission requests 124 // Packet retransmission requests
114 // TODO(holmer): Add API for changing Process interval and make sure it's 125 // TODO(holmer): Add API for changing Process interval and make sure it's
115 // disabled when NACK is off. 126 // disabled when NACK is off.
116 if (_retransmissionTimer.TimeUntilProcess() == 0) { 127 if (_retransmissionTimer.TimeUntilProcess() == 0) {
117 _retransmissionTimer.Processed(); 128 _retransmissionTimer.Processed();
118 bool callback_registered = false; 129 bool callback_registered = false;
119 uint16_t length; 130 uint16_t length;
120 { 131 {
121 CriticalSectionScoped cs(process_crit_sect_.get()); 132 CriticalSectionScoped cs(process_crit_sect_.get());
122 length = max_nack_list_size_; 133 length = max_nack_list_size_;
(...skipping 20 matching lines...) Expand all
143 int64_t VideoReceiver::TimeUntilNextProcess() { 154 int64_t VideoReceiver::TimeUntilNextProcess() {
144 int64_t timeUntilNextProcess = _receiveStatsTimer.TimeUntilProcess(); 155 int64_t timeUntilNextProcess = _receiveStatsTimer.TimeUntilProcess();
145 if (_receiver.NackMode() != kNoNack) { 156 if (_receiver.NackMode() != kNoNack) {
146 // We need a Process call more often if we are relying on 157 // We need a Process call more often if we are relying on
147 // retransmissions 158 // retransmissions
148 timeUntilNextProcess = 159 timeUntilNextProcess =
149 VCM_MIN(timeUntilNextProcess, _retransmissionTimer.TimeUntilProcess()); 160 VCM_MIN(timeUntilNextProcess, _retransmissionTimer.TimeUntilProcess());
150 } 161 }
151 timeUntilNextProcess = 162 timeUntilNextProcess =
152 VCM_MIN(timeUntilNextProcess, _keyRequestTimer.TimeUntilProcess()); 163 VCM_MIN(timeUntilNextProcess, _keyRequestTimer.TimeUntilProcess());
164 timeUntilNextProcess =
165 VCM_MIN(timeUntilNextProcess, _receiver.TimeUntilNextProcess());
153 166
154 return timeUntilNextProcess; 167 return timeUntilNextProcess;
155 } 168 }
156 169
157 int32_t VideoReceiver::SetReceiveChannelParameters(int64_t rtt) { 170 int32_t VideoReceiver::SetReceiveChannelParameters(int64_t rtt) {
158 CriticalSectionScoped receiveCs(_receiveCritSect); 171 CriticalSectionScoped receiveCs(_receiveCritSect);
159 _receiver.UpdateRtt(rtt); 172 _receiver.UpdateRtt(rtt);
160 return 0; 173 return 0;
161 } 174 }
162 175
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 540 }
528 541
529 void VideoReceiver::RegisterPreDecodeImageCallback( 542 void VideoReceiver::RegisterPreDecodeImageCallback(
530 EncodedImageCallback* observer) { 543 EncodedImageCallback* observer) {
531 CriticalSectionScoped cs(_receiveCritSect); 544 CriticalSectionScoped cs(_receiveCritSect);
532 pre_decode_image_callback_ = observer; 545 pre_decode_image_callback_ = observer;
533 } 546 }
534 547
535 } // namespace vcm 548 } // namespace vcm
536 } // namespace webrtc 549 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/video_coding_impl.cc ('k') | webrtc/video/video_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698