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

Unified Diff: content/renderer/media/rtc_video_encoder.cc

Issue 1928873002: Revert to recreating RTCVideoEncoder::Impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/rtc_video_encoder.cc
diff --git a/content/renderer/media/rtc_video_encoder.cc b/content/renderer/media/rtc_video_encoder.cc
index 2a2891cc07fc3ee3591bd764498696fc1dcbfe70..694e4261a16197eaa95727f775dc14cbee619137 100644
--- a/content/renderer/media/rtc_video_encoder.cc
+++ b/content/renderer/media/rtc_video_encoder.cc
@@ -164,6 +164,9 @@ class RTCVideoEncoder::Impl
~Impl() override;
+ // Resets the class members.
+ void Reset();
+
// Logs the |error| and |str| sent from |location| and NotifyError()s forward.
void LogAndNotifyError(const tracked_objects::Location& location,
const std::string& str,
@@ -262,14 +265,11 @@ RTCVideoEncoder::Impl::Impl(media::GpuVideoAcceleratorFactories* gpu_factories,
async_waiter_(NULL),
async_retval_(NULL),
input_next_frame_(NULL),
- input_next_frame_keyframe_(false),
- output_buffers_free_count_(0),
encoded_image_callback_(nullptr),
video_codec_type_(video_codec_type),
status_(WEBRTC_VIDEO_CODEC_UNINITIALIZED) {
thread_checker_.DetachFromThread();
- // Picture ID should start on a random number.
- picture_id_ = static_cast<uint16_t>(base::RandInt(0, 0x7FFF));
+ Reset();
wuchengli 2016/04/29 13:58:24 This means RTCVideoEncoder is reused after RTCVide
emircan 2016/04/29 19:37:27 Sure, reverting to earlier sounds better as the de
}
void RTCVideoEncoder::Impl::CreateAndInitializeVEA(
@@ -386,6 +386,7 @@ void RTCVideoEncoder::Impl::Destroy(base::WaitableEvent* async_waiter) {
video_encoder_.reset();
SetStatus(WEBRTC_VIDEO_CODEC_UNINITIALIZED);
}
+ Reset();
async_waiter->Signal();
}
@@ -517,6 +518,16 @@ void RTCVideoEncoder::Impl::NotifyError(
RTCVideoEncoder::Impl::~Impl() { DCHECK(!video_encoder_); }
+void RTCVideoEncoder::Impl::Reset() {
+ input_next_frame_keyframe_ = false;
+ input_buffers_.clear();
+ output_buffers_.clear();
+ input_buffers_free_.clear();
+ output_buffers_free_count_ = 0;
+ // Picture ID should start on a random number.
+ picture_id_ = static_cast<uint16_t>(base::RandInt(0, 0x7FFF));
+}
+
void RTCVideoEncoder::Impl::LogAndNotifyError(
const tracked_objects::Location& location,
const std::string& str,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698