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

Side by Side Diff: webrtc/video/video_receive_stream.cc

Issue 1181653002: Base A/V synchronization on sync_labels. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix win compile error, bah Created 5 years, 6 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
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
(...skipping 29 matching lines...) Expand all
40 ss << "{decoders: ["; 40 ss << "{decoders: [";
41 for (size_t i = 0; i < decoders.size(); ++i) { 41 for (size_t i = 0; i < decoders.size(); ++i) {
42 ss << decoders[i].ToString(); 42 ss << decoders[i].ToString();
43 if (i != decoders.size() - 1) 43 if (i != decoders.size() - 1)
44 ss << ", "; 44 ss << ", ";
45 } 45 }
46 ss << ']'; 46 ss << ']';
47 ss << ", rtp: " << rtp.ToString(); 47 ss << ", rtp: " << rtp.ToString();
48 ss << ", renderer: " << (renderer != nullptr ? "(renderer)" : "nullptr"); 48 ss << ", renderer: " << (renderer != nullptr ? "(renderer)" : "nullptr");
49 ss << ", render_delay_ms: " << render_delay_ms; 49 ss << ", render_delay_ms: " << render_delay_ms;
50 ss << ", audio_channel_id: " << audio_channel_id; 50 if (!sync_group.empty())
51 ss << ", sync_group: " << sync_group;
51 ss << ", pre_decode_callback: " 52 ss << ", pre_decode_callback: "
52 << (pre_decode_callback != nullptr ? "(EncodedFrameObserver)" : "nullptr"); 53 << (pre_decode_callback != nullptr ? "(EncodedFrameObserver)" : "nullptr");
53 ss << ", pre_render_callback: " 54 ss << ", pre_render_callback: "
54 << (pre_render_callback != nullptr ? "(I420FrameCallback)" : "nullptr"); 55 << (pre_render_callback != nullptr ? "(I420FrameCallback)" : "nullptr");
55 ss << ", target_delay_ms: " << target_delay_ms; 56 ss << ", target_delay_ms: " << target_delay_ms;
56 ss << '}'; 57 ss << '}';
57 58
58 return ss.str(); 59 return ss.str();
59 } 60 }
60 61
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 VideoCodec codec = CreateDecoderVideoCodec(decoder); 235 VideoCodec codec = CreateDecoderVideoCodec(decoder);
235 236
236 CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); 237 CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec));
237 } 238 }
238 239
239 incoming_video_stream_.reset(new IncomingVideoStream(0)); 240 incoming_video_stream_.reset(new IncomingVideoStream(0));
240 incoming_video_stream_->SetExpectedRenderDelay(config.render_delay_ms); 241 incoming_video_stream_->SetExpectedRenderDelay(config.render_delay_ms);
241 incoming_video_stream_->SetExternalCallback(this); 242 incoming_video_stream_->SetExternalCallback(this);
242 vie_channel_->SetIncomingVideoStream(incoming_video_stream_.get()); 243 vie_channel_->SetIncomingVideoStream(incoming_video_stream_.get());
243 244
244 if (voice_engine && config_.audio_channel_id != -1) {
245 voe_sync_interface_ = VoEVideoSync::GetInterface(voice_engine);
246 vie_channel_->SetVoiceChannel(config.audio_channel_id, voe_sync_interface_);
247 }
248
249 if (config.pre_decode_callback) 245 if (config.pre_decode_callback)
250 vie_channel_->RegisterPreDecodeImageCallback(&encoded_frame_proxy_); 246 vie_channel_->RegisterPreDecodeImageCallback(&encoded_frame_proxy_);
251 vie_channel_->RegisterPreRenderCallback(this); 247 vie_channel_->RegisterPreRenderCallback(this);
252 } 248 }
253 249
254 VideoReceiveStream::~VideoReceiveStream() { 250 VideoReceiveStream::~VideoReceiveStream() {
251 DCHECK(voe_sync_interface_ == nullptr);
255 incoming_video_stream_->Stop(); 252 incoming_video_stream_->Stop();
256 vie_channel_->RegisterPreRenderCallback(nullptr); 253 vie_channel_->RegisterPreRenderCallback(nullptr);
257 vie_channel_->RegisterPreDecodeImageCallback(nullptr); 254 vie_channel_->RegisterPreDecodeImageCallback(nullptr);
258 255
259 for (size_t i = 0; i < config_.decoders.size(); ++i) 256 for (size_t i = 0; i < config_.decoders.size(); ++i)
260 vie_channel_->DeRegisterExternalDecoder(config_.decoders[i].payload_type); 257 vie_channel_->DeRegisterExternalDecoder(config_.decoders[i].payload_type);
261 258
262 if (voe_sync_interface_ != nullptr) {
263 vie_channel_->SetVoiceChannel(-1, nullptr);
264 voe_sync_interface_->Release();
265 }
266 vie_channel_->RegisterCodecObserver(nullptr); 259 vie_channel_->RegisterCodecObserver(nullptr);
267 vie_channel_->RegisterReceiveChannelRtpStatisticsCallback(nullptr); 260 vie_channel_->RegisterReceiveChannelRtpStatisticsCallback(nullptr);
268 vie_channel_->RegisterReceiveChannelRtcpStatisticsCallback(nullptr); 261 vie_channel_->RegisterReceiveChannelRtcpStatisticsCallback(nullptr);
269 vie_channel_->RegisterRtcpPacketTypeCounterObserver(nullptr); 262 vie_channel_->RegisterRtcpPacketTypeCounterObserver(nullptr);
270 channel_group_->DeleteChannel(channel_id_); 263 channel_group_->DeleteChannel(channel_id_);
271 } 264 }
272 265
273 void VideoReceiveStream::Start() { 266 void VideoReceiveStream::Start() {
274 transport_adapter_.Enable(); 267 transport_adapter_.Enable();
275 incoming_video_stream_->Start(); 268 incoming_video_stream_->Start();
276 vie_channel_->StartReceive(); 269 vie_channel_->StartReceive();
277 } 270 }
278 271
279 void VideoReceiveStream::Stop() { 272 void VideoReceiveStream::Stop() {
280 incoming_video_stream_->Stop(); 273 incoming_video_stream_->Stop();
281 vie_channel_->StopReceive(); 274 vie_channel_->StopReceive();
282 transport_adapter_.Disable(); 275 transport_adapter_.Disable();
283 } 276 }
284 277
278 void VideoReceiveStream::SetSyncChannel(VoiceEngine* voice_engine,
279 int audio_channel_id) {
280 DCHECK(voice_engine != nullptr);
281 if (audio_channel_id != -1) {
282 voe_sync_interface_ = VoEVideoSync::GetInterface(voice_engine);
283 vie_channel_->SetVoiceChannel(audio_channel_id, voe_sync_interface_);
284 } else {
285 vie_channel_->SetVoiceChannel(-1, nullptr);
286 voe_sync_interface_->Release();
287 voe_sync_interface_ = nullptr;
288 }
289 }
290
285 VideoReceiveStream::Stats VideoReceiveStream::GetStats() const { 291 VideoReceiveStream::Stats VideoReceiveStream::GetStats() const {
286 return stats_proxy_->GetStats(); 292 return stats_proxy_->GetStats();
287 } 293 }
288 294
289 bool VideoReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { 295 bool VideoReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) {
290 return vie_channel_->ReceivedRTCPPacket(packet, length) == 0; 296 return vie_channel_->ReceivedRTCPPacket(packet, length) == 0;
291 } 297 }
292 298
293 bool VideoReceiveStream::DeliverRtp(const uint8_t* packet, size_t length) { 299 bool VideoReceiveStream::DeliverRtp(const uint8_t* packet, size_t length) {
294 return vie_channel_->ReceivedRTPPacket(packet, length, PacketTime()) == 0; 300 return vie_channel_->ReceivedRTPPacket(packet, length, PacketTime()) == 0;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 case newapi::kRtcpCompound: 338 case newapi::kRtcpCompound:
333 vie_channel_->SetRTCPMode(kRtcpCompound); 339 vie_channel_->SetRTCPMode(kRtcpCompound);
334 break; 340 break;
335 case newapi::kRtcpReducedSize: 341 case newapi::kRtcpReducedSize:
336 vie_channel_->SetRTCPMode(kRtcpNonCompound); 342 vie_channel_->SetRTCPMode(kRtcpNonCompound);
337 break; 343 break;
338 } 344 }
339 } 345 }
340 } // namespace internal 346 } // namespace internal
341 } // namespace webrtc 347 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698