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

Unified Diff: webrtc/video/video_receive_stream.cc

Issue 2303273002: Expose Ivf logging through the native API (Closed)
Patch Set: Nit Created 4 years, 3 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_receive_stream.cc
diff --git a/webrtc/video/video_receive_stream.cc b/webrtc/video/video_receive_stream.cc
index 01568cb3df5301c0cf0c021000bcab1ef2f112fb..6e9633f1b25b2e92a6a8f2f9cce1d0d6d568de18 100644
--- a/webrtc/video/video_receive_stream.cc
+++ b/webrtc/video/video_receive_stream.cc
@@ -31,8 +31,6 @@
namespace webrtc {
-static const bool kEnableFrameRecording = false;
-
static bool UseSendSideBwe(const VideoReceiveStream::Config& config) {
if (!config.rtp.transport_cc)
return false;
@@ -365,16 +363,12 @@ EncodedImageCallback::Result VideoReceiveStream::OnEncodedImage(
EncodedFrame(encoded_image._buffer, encoded_image._length,
encoded_image._frameType));
}
- if (kEnableFrameRecording) {
- if (!ivf_writer_.get()) {
- RTC_DCHECK(codec_specific_info);
- std::ostringstream oss;
- oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf";
- ivf_writer_ =
- IvfFileWriter::Open(oss.str(), codec_specific_info->codecType);
- }
+ {
+ rtc::CritScope lock(&ivf_writer_lock_);
if (ivf_writer_.get()) {
- bool ok = ivf_writer_->WriteFrame(encoded_image);
+ RTC_DCHECK(codec_specific_info);
+ bool ok = ivf_writer_->WriteFrame(encoded_image,
+ codec_specific_info->codecType);
RTC_DCHECK(ok);
}
}
@@ -397,6 +391,24 @@ void VideoReceiveStream::SendNack(
rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers);
}
+void VideoReceiveStream::EnableEncodedFrameRecording(rtc::PlatformFile file,
+ size_t byte_limit) {
+ {
+ rtc::CritScope lock(&ivf_writer_lock_);
+ if (file == rtc::kInvalidPlatformFileValue) {
+ ivf_writer_.reset();
+ } else {
+ ivf_writer_ = IvfFileWriter::Wrap(rtc::File(file), byte_limit);
+ }
+ }
+
+ if (file != rtc::kInvalidPlatformFileValue) {
+ // Make a keyframe appear as early as possible in the logs, to give actually
+ // decodable output.
+ RequestKeyFrame();
+ }
+}
+
void VideoReceiveStream::RequestKeyFrame() {
rtp_stream_receiver_.RequestKeyFrame();
}
« 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