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 13 matching lines...) Expand all Loading... | |
24 #include "webrtc/modules/video_coding/include/video_coding.h" | 24 #include "webrtc/modules/video_coding/include/video_coding.h" |
25 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | 25 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
26 #include "webrtc/system_wrappers/include/clock.h" | 26 #include "webrtc/system_wrappers/include/clock.h" |
27 #include "webrtc/video/call_stats.h" | 27 #include "webrtc/video/call_stats.h" |
28 #include "webrtc/video/receive_statistics_proxy.h" | 28 #include "webrtc/video/receive_statistics_proxy.h" |
29 #include "webrtc/video_receive_stream.h" | 29 #include "webrtc/video_receive_stream.h" |
30 #include "webrtc/voice_engine/include/voe_video_sync.h" | 30 #include "webrtc/voice_engine/include/voe_video_sync.h" |
31 | 31 |
32 namespace webrtc { | 32 namespace webrtc { |
33 | 33 |
34 static const bool kEnableFrameRecording = false; | |
35 | |
36 static bool UseSendSideBwe(const VideoReceiveStream::Config& config) { | 34 static bool UseSendSideBwe(const VideoReceiveStream::Config& config) { |
37 if (!config.rtp.transport_cc) | 35 if (!config.rtp.transport_cc) |
38 return false; | 36 return false; |
39 for (const auto& extension : config.rtp.extensions) { | 37 for (const auto& extension : config.rtp.extensions) { |
40 if (extension.uri == RtpExtension::kTransportSequenceNumberUri) | 38 if (extension.uri == RtpExtension::kTransportSequenceNumberUri) |
41 return true; | 39 return true; |
42 } | 40 } |
43 return false; | 41 return false; |
44 } | 42 } |
45 | 43 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 EncodedImageCallback::Result VideoReceiveStream::OnEncodedImage( | 356 EncodedImageCallback::Result VideoReceiveStream::OnEncodedImage( |
359 const EncodedImage& encoded_image, | 357 const EncodedImage& encoded_image, |
360 const CodecSpecificInfo* codec_specific_info, | 358 const CodecSpecificInfo* codec_specific_info, |
361 const RTPFragmentationHeader* fragmentation) { | 359 const RTPFragmentationHeader* fragmentation) { |
362 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); | 360 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); |
363 if (config_.pre_decode_callback) { | 361 if (config_.pre_decode_callback) { |
364 config_.pre_decode_callback->EncodedFrameCallback( | 362 config_.pre_decode_callback->EncodedFrameCallback( |
365 EncodedFrame(encoded_image._buffer, encoded_image._length, | 363 EncodedFrame(encoded_image._buffer, encoded_image._length, |
366 encoded_image._frameType)); | 364 encoded_image._frameType)); |
367 } | 365 } |
368 if (kEnableFrameRecording) { | 366 { |
369 if (!ivf_writer_.get()) { | 367 rtc::CritScope lock(&ivf_writer_crit_); |
368 if (ivf_writer_.get()) { | |
370 RTC_DCHECK(codec_specific_info); | 369 RTC_DCHECK(codec_specific_info); |
371 std::ostringstream oss; | 370 bool ok = ivf_writer_->WriteFrame(encoded_image, |
372 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf"; | 371 codec_specific_info->codecType); |
373 ivf_writer_ = | |
374 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); | |
375 } | |
376 if (ivf_writer_.get()) { | |
377 bool ok = ivf_writer_->WriteFrame(encoded_image); | |
378 RTC_DCHECK(ok); | 372 RTC_DCHECK(ok); |
379 } | 373 } |
380 } | 374 } |
381 | 375 |
382 return Result(Result::OK, encoded_image._timeStamp); | 376 return Result(Result::OK, encoded_image._timeStamp); |
383 } | 377 } |
384 | 378 |
385 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { | 379 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { |
386 static_cast<VideoReceiveStream*>(ptr)->Decode(); | 380 static_cast<VideoReceiveStream*>(ptr)->Decode(); |
387 return true; | 381 return true; |
388 } | 382 } |
389 | 383 |
390 void VideoReceiveStream::Decode() { | 384 void VideoReceiveStream::Decode() { |
391 static const int kMaxDecodeWaitTimeMs = 50; | 385 static const int kMaxDecodeWaitTimeMs = 50; |
392 video_receiver_.Decode(kMaxDecodeWaitTimeMs); | 386 video_receiver_.Decode(kMaxDecodeWaitTimeMs); |
393 } | 387 } |
394 | 388 |
395 void VideoReceiveStream::SendNack( | 389 void VideoReceiveStream::SendNack( |
396 const std::vector<uint16_t>& sequence_numbers) { | 390 const std::vector<uint16_t>& sequence_numbers) { |
397 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers); | 391 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers); |
398 } | 392 } |
399 | 393 |
394 void VideoReceiveStream::SetLogFile(rtc::PlatformFile file) { | |
395 { | |
396 rtc::CritScope lock(&ivf_writer_crit_); | |
397 if (file == rtc::kInvalidPlatformFileValue) { | |
398 ivf_writer_.reset(); | |
399 } else { | |
400 ivf_writer_ = IvfFileWriter::Wrap(rtc::File(file)); | |
401 } | |
402 } | |
403 | |
404 if (file != rtc::kInvalidPlatformFileValue) | |
405 RequestKeyFrame(); | |
sprang_webrtc
2016/09/04 14:48:48
Add comment why this is done
| |
406 } | |
407 | |
400 void VideoReceiveStream::RequestKeyFrame() { | 408 void VideoReceiveStream::RequestKeyFrame() { |
401 rtp_stream_receiver_.RequestKeyFrame(); | 409 rtp_stream_receiver_.RequestKeyFrame(); |
402 } | 410 } |
403 | 411 |
404 } // namespace internal | 412 } // namespace internal |
405 } // namespace webrtc | 413 } // namespace webrtc |
OLD | NEW |