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

Unified Diff: webrtc/video/video_receive_stream.cc

Issue 2303273002: Expose Ivf logging through the native API (Closed)
Patch Set: Fix memory leak 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
Index: webrtc/video/video_receive_stream.cc
diff --git a/webrtc/video/video_receive_stream.cc b/webrtc/video/video_receive_stream.cc
index 86bb76f4bbdb7244b0f37307b604ba68a515ab99..465d46276345a9598c6e6491273ddf29d414b857 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_crit_);
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,20 @@ void VideoReceiveStream::SendNack(
rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers);
}
+void VideoReceiveStream::SetLogFile(rtc::PlatformFile file) {
+ {
+ rtc::CritScope lock(&ivf_writer_crit_);
+ if (file == rtc::kInvalidPlatformFileValue) {
+ ivf_writer_.reset();
+ } else {
+ ivf_writer_ = IvfFileWriter::Wrap(rtc::File(file));
+ }
+ }
+
+ if (file != rtc::kInvalidPlatformFileValue)
+ RequestKeyFrame();
sprang_webrtc 2016/09/04 14:48:48 Add comment why this is done
+}
+
void VideoReceiveStream::RequestKeyFrame() {
rtp_stream_receiver_.RequestKeyFrame();
}

Powered by Google App Engine
This is Rietveld 408576698