OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 return false; | 34 return false; |
35 for (const auto& extension : config.rtp.extensions) { | 35 for (const auto& extension : config.rtp.extensions) { |
36 if (extension.name == RtpExtension::kTransportSequenceNumber) | 36 if (extension.name == RtpExtension::kTransportSequenceNumber) |
37 return true; | 37 return true; |
38 } | 38 } |
39 return false; | 39 return false; |
40 } | 40 } |
41 | 41 |
42 std::string VideoReceiveStream::Decoder::ToString() const { | 42 std::string VideoReceiveStream::Decoder::ToString() const { |
43 std::stringstream ss; | 43 std::stringstream ss; |
44 ss << "{decoder: " << (decoder != nullptr ? "(VideoDecoder)" : "nullptr"); | 44 ss << "{decoder: " << (decoder ? "(VideoDecoder)" : "nullptr"); |
45 ss << ", payload_type: " << payload_type; | 45 ss << ", payload_type: " << payload_type; |
46 ss << ", payload_name: " << payload_name; | 46 ss << ", payload_name: " << payload_name; |
47 ss << '}'; | 47 ss << '}'; |
48 | 48 |
49 return ss.str(); | 49 return ss.str(); |
50 } | 50 } |
51 | 51 |
52 std::string VideoReceiveStream::Config::ToString() const { | 52 std::string VideoReceiveStream::Config::ToString() const { |
53 std::stringstream ss; | 53 std::stringstream ss; |
54 ss << "{decoders: ["; | 54 ss << "{decoders: ["; |
55 for (size_t i = 0; i < decoders.size(); ++i) { | 55 for (size_t i = 0; i < decoders.size(); ++i) { |
56 ss << decoders[i].ToString(); | 56 ss << decoders[i].ToString(); |
57 if (i != decoders.size() - 1) | 57 if (i != decoders.size() - 1) |
58 ss << ", "; | 58 ss << ", "; |
59 } | 59 } |
60 ss << ']'; | 60 ss << ']'; |
61 ss << ", rtp: " << rtp.ToString(); | 61 ss << ", rtp: " << rtp.ToString(); |
62 ss << ", renderer: " << (renderer != nullptr ? "(renderer)" : "nullptr"); | 62 ss << ", renderer: " << (renderer ? "(renderer)" : "nullptr"); |
63 ss << ", render_delay_ms: " << render_delay_ms; | 63 ss << ", render_delay_ms: " << render_delay_ms; |
64 if (!sync_group.empty()) | 64 if (!sync_group.empty()) |
65 ss << ", sync_group: " << sync_group; | 65 ss << ", sync_group: " << sync_group; |
66 ss << ", pre_decode_callback: " | 66 ss << ", pre_decode_callback: " |
67 << (pre_decode_callback != nullptr ? "(EncodedFrameObserver)" : "nullptr"); | 67 << (pre_decode_callback ? "(EncodedFrameObserver)" : "nullptr"); |
68 ss << ", pre_render_callback: " | 68 ss << ", pre_render_callback: " |
69 << (pre_render_callback != nullptr ? "(I420FrameCallback)" : "nullptr"); | 69 << (pre_render_callback ? "(I420FrameCallback)" : "nullptr"); |
70 ss << ", target_delay_ms: " << target_delay_ms; | 70 ss << ", target_delay_ms: " << target_delay_ms; |
71 ss << '}'; | 71 ss << '}'; |
72 | 72 |
73 return ss.str(); | 73 return ss.str(); |
74 } | 74 } |
75 | 75 |
76 std::string VideoReceiveStream::Config::Rtp::ToString() const { | 76 std::string VideoReceiveStream::Config::Rtp::ToString() const { |
77 std::stringstream ss; | 77 std::stringstream ss; |
78 ss << "{remote_ssrc: " << remote_ssrc; | 78 ss << "{remote_ssrc: " << remote_ssrc; |
79 ss << ", local_ssrc: " << local_ssrc; | 79 ss << ", local_ssrc: " << local_ssrc; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 void VideoReceiveStream::Stop() { | 338 void VideoReceiveStream::Stop() { |
339 incoming_video_stream_.Stop(); | 339 incoming_video_stream_.Stop(); |
340 vie_receiver_->StopReceive(); | 340 vie_receiver_->StopReceive(); |
341 vcm_->TriggerDecoderShutdown(); | 341 vcm_->TriggerDecoderShutdown(); |
342 decode_thread_.Stop(); | 342 decode_thread_.Stop(); |
343 transport_adapter_.Disable(); | 343 transport_adapter_.Disable(); |
344 } | 344 } |
345 | 345 |
346 void VideoReceiveStream::SetSyncChannel(VoiceEngine* voice_engine, | 346 void VideoReceiveStream::SetSyncChannel(VoiceEngine* voice_engine, |
347 int audio_channel_id) { | 347 int audio_channel_id) { |
348 if (voice_engine != nullptr && audio_channel_id != -1) { | 348 if (voice_engine && audio_channel_id != -1) { |
349 VoEVideoSync* voe_sync_interface = VoEVideoSync::GetInterface(voice_engine); | 349 VoEVideoSync* voe_sync_interface = VoEVideoSync::GetInterface(voice_engine); |
350 vie_sync_.ConfigureSync(audio_channel_id, voe_sync_interface, rtp_rtcp_, | 350 vie_sync_.ConfigureSync(audio_channel_id, voe_sync_interface, rtp_rtcp_, |
351 vie_receiver_->GetRtpReceiver()); | 351 vie_receiver_->GetRtpReceiver()); |
352 voe_sync_interface->Release(); | 352 voe_sync_interface->Release(); |
353 return; | 353 return; |
354 } | 354 } |
355 vie_sync_.ConfigureSync(-1, nullptr, rtp_rtcp_, | 355 vie_sync_.ConfigureSync(-1, nullptr, rtp_rtcp_, |
356 vie_receiver_->GetRtpReceiver()); | 356 vie_receiver_->GetRtpReceiver()); |
357 } | 357 } |
358 | 358 |
359 VideoReceiveStream::Stats VideoReceiveStream::GetStats() const { | 359 VideoReceiveStream::Stats VideoReceiveStream::GetStats() const { |
360 return stats_proxy_.GetStats(); | 360 return stats_proxy_.GetStats(); |
361 } | 361 } |
362 | 362 |
363 bool VideoReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { | 363 bool VideoReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
364 return vie_receiver_->DeliverRtcp(packet, length); | 364 return vie_receiver_->DeliverRtcp(packet, length); |
365 } | 365 } |
366 | 366 |
367 bool VideoReceiveStream::DeliverRtp(const uint8_t* packet, | 367 bool VideoReceiveStream::DeliverRtp(const uint8_t* packet, |
368 size_t length, | 368 size_t length, |
369 const PacketTime& packet_time) { | 369 const PacketTime& packet_time) { |
370 return vie_receiver_->DeliverRtp(packet, length, packet_time); | 370 return vie_receiver_->DeliverRtp(packet, length, packet_time); |
371 } | 371 } |
372 | 372 |
373 void VideoReceiveStream::FrameCallback(VideoFrame* video_frame) { | 373 void VideoReceiveStream::FrameCallback(VideoFrame* video_frame) { |
374 stats_proxy_.OnDecodedFrame(); | 374 stats_proxy_.OnDecodedFrame(); |
375 | 375 |
376 // Post processing is not supported if the frame is backed by a texture. | 376 // Post processing is not supported if the frame is backed by a texture. |
377 if (video_frame->native_handle() == NULL) { | 377 if (!video_frame->native_handle()) { |
378 if (config_.pre_render_callback) | 378 if (config_.pre_render_callback) |
379 config_.pre_render_callback->FrameCallback(video_frame); | 379 config_.pre_render_callback->FrameCallback(video_frame); |
380 } | 380 } |
381 } | 381 } |
382 | 382 |
383 int VideoReceiveStream::RenderFrame(const uint32_t /*stream_id*/, | 383 int VideoReceiveStream::RenderFrame(const uint32_t /*stream_id*/, |
384 const VideoFrame& video_frame) { | 384 const VideoFrame& video_frame) { |
385 int64_t sync_offset_ms; | 385 int64_t sync_offset_ms; |
386 if (vie_sync_.GetStreamSyncOffsetInMs(video_frame, &sync_offset_ms)) | 386 if (vie_sync_.GetStreamSyncOffsetInMs(video_frame, &sync_offset_ms)) |
387 stats_proxy_.OnSyncOffsetUpdated(sync_offset_ms); | 387 stats_proxy_.OnSyncOffsetUpdated(sync_offset_ms); |
388 | 388 |
389 if (config_.renderer != nullptr) | 389 if (config_.renderer) |
390 config_.renderer->OnFrame(video_frame); | 390 config_.renderer->OnFrame(video_frame); |
391 | 391 |
392 stats_proxy_.OnRenderedFrame(video_frame); | 392 stats_proxy_.OnRenderedFrame(video_frame); |
393 | 393 |
394 return 0; | 394 return 0; |
395 } | 395 } |
396 | 396 |
397 // TODO(asapersson): Consider moving callback from video_encoder.h or | 397 // TODO(asapersson): Consider moving callback from video_encoder.h or |
398 // creating a different callback. | 398 // creating a different callback. |
399 int32_t VideoReceiveStream::Encoded( | 399 int32_t VideoReceiveStream::Encoded( |
(...skipping 28 matching lines...) Expand all Loading... |
428 const std::vector<uint16_t>& sequence_numbers) { | 428 const std::vector<uint16_t>& sequence_numbers) { |
429 rtp_rtcp_->SendNack(sequence_numbers); | 429 rtp_rtcp_->SendNack(sequence_numbers); |
430 } | 430 } |
431 | 431 |
432 void VideoReceiveStream::RequestKeyFrame() { | 432 void VideoReceiveStream::RequestKeyFrame() { |
433 rtp_rtcp_->RequestKeyFrame(); | 433 rtp_rtcp_->RequestKeyFrame(); |
434 } | 434 } |
435 | 435 |
436 } // namespace internal | 436 } // namespace internal |
437 } // namespace webrtc | 437 } // namespace webrtc |
OLD | NEW |