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

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

Issue 10918172: Remove VideoDecoder::PrepareForShutdownHack() and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blah Created 8 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 | « content/renderer/media/rtc_video_decoder.h ('k') | content/renderer/media/rtc_video_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/rtc_video_decoder.cc
diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc
index 810856706ba54ca2d3ba92ca46b38ba056cc53c8..d86a2ae10ebb8b9c5a2ecd8149a6a2c69cb2a540 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -34,7 +34,6 @@ RTCVideoDecoder::RTCVideoDecoder(base::TaskRunner* video_decoder_thread,
visible_size_(640, 480),
state_(kUnInitialized),
got_first_frame_(false),
- shutting_down_(false),
video_track_(video_track) {
}
@@ -68,12 +67,13 @@ void RTCVideoDecoder::Read(const ReadCB& read_cb) {
base::AutoLock auto_lock(lock_);
CHECK(read_cb_.is_null());
- read_cb_ = read_cb;
- if (shutting_down_) {
- video_decoder_thread_->PostTask(FROM_HERE,
- base::Bind(&RTCVideoDecoder::CancelPendingRead, this));
+ if (state_ == kStopped) {
+ read_cb.Run(kOk, NULL);
+ return;
}
+
+ read_cb_ = read_cb;
}
void RTCVideoDecoder::Reset(const base::Closure& closure) {
@@ -99,18 +99,8 @@ void RTCVideoDecoder::Stop(const base::Closure& closure) {
}
state_ = kStopped;
- closure.Run();
-}
-
-void RTCVideoDecoder::PrepareForShutdownHack() {
- if (!video_decoder_thread_->RunsTasksOnCurrentThread()) {
- video_decoder_thread_->PostTask(
- FROM_HERE, base::Bind(&RTCVideoDecoder::PrepareForShutdownHack,
- this));
- return;
- }
- shutting_down_ = true;
CancelPendingRead();
+ closure.Run();
}
void RTCVideoDecoder::SetSize(int width, int height) {
« no previous file with comments | « content/renderer/media/rtc_video_decoder.h ('k') | content/renderer/media/rtc_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698