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

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

Issue 2303273002: Expose Ivf logging through the native API (Closed)
Patch Set: Nit Created 4 years, 2 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/video/video_receive_stream.h ('k') | webrtc/video/video_send_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
(...skipping 13 matching lines...) Expand all
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
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_lock_);
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::EnableEncodedFrameRecording(rtc::PlatformFile file,
395 size_t byte_limit) {
396 {
397 rtc::CritScope lock(&ivf_writer_lock_);
398 if (file == rtc::kInvalidPlatformFileValue) {
399 ivf_writer_.reset();
400 } else {
401 ivf_writer_ = IvfFileWriter::Wrap(rtc::File(file), byte_limit);
402 }
403 }
404
405 if (file != rtc::kInvalidPlatformFileValue) {
406 // Make a keyframe appear as early as possible in the logs, to give actually
407 // decodable output.
408 RequestKeyFrame();
409 }
410 }
411
400 void VideoReceiveStream::RequestKeyFrame() { 412 void VideoReceiveStream::RequestKeyFrame() {
401 rtp_stream_receiver_.RequestKeyFrame(); 413 rtp_stream_receiver_.RequestKeyFrame();
402 } 414 }
403 415
404 } // namespace internal 416 } // namespace internal
405 } // namespace webrtc 417 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_receive_stream.h ('k') | webrtc/video/video_send_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698