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

Unified Diff: remoting/host/screen_recorder.cc

Issue 7563026: Fix crash in ScreenRecorder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 4 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 | « remoting/host/screen_recorder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/screen_recorder.cc
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc
index 0b1d1d13b99317e71f4e9ab5495fbbfce82f1c69..1a05797f8faa7e1631b8cf7dbec23f8f38fc8dfe 100644
--- a/remoting/host/screen_recorder.cc
+++ b/remoting/host/screen_recorder.cc
@@ -47,6 +47,7 @@ ScreenRecorder::ScreenRecorder(
encoder_(encoder),
is_recording_(false),
network_stopped_(false),
+ encoder_stopped_(false),
recordings_(0),
frame_skipped_(false),
max_rate_(kDefaultCaptureRate),
@@ -387,6 +388,8 @@ void ScreenRecorder::DoEncode(
void ScreenRecorder::DoStopOnEncodeThread(Task* done_task) {
DCHECK_EQ(encode_loop_, MessageLoop::current());
+ encoder_stopped_ = true;
+
// When this method is being executed there are no more tasks on encode thread
// for this object. We can then post a task to capture thread to finish the
// stop sequence.
@@ -397,6 +400,9 @@ void ScreenRecorder::DoStopOnEncodeThread(Task* done_task) {
void ScreenRecorder::EncodedDataAvailableCallback(VideoPacket* packet) {
DCHECK_EQ(encode_loop_, MessageLoop::current());
+ if (encoder_stopped_)
+ return;
+
bool last = (packet->flags() & VideoPacket::LAST_PACKET) != 0;
if (last) {
int encode_time = static_cast<int>(
« no previous file with comments | « remoting/host/screen_recorder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698