Index: media/capture/video/file_video_capture_device.cc |
diff --git a/media/capture/video/file_video_capture_device.cc b/media/capture/video/file_video_capture_device.cc |
index bdac8fbfe0bae6edb2cb5a07dced625f77c99bfc..14d835c25b9ba5f32ece71a406312c72040134c5 100644 |
--- a/media/capture/video/file_video_capture_device.cc |
+++ b/media/capture/video/file_video_capture_device.cc |
@@ -299,7 +299,7 @@ std::unique_ptr<VideoFileParser> FileVideoCaptureDevice::GetVideoFileParser( |
} |
FileVideoCaptureDevice::FileVideoCaptureDevice(const base::FilePath& file_path) |
- : capture_thread_("CaptureThread"), file_path_(file_path) {} |
+ : capture_thread_("CaptureThread"), file_path_(file_path), capture_(0) {} |
FileVideoCaptureDevice::~FileVideoCaptureDevice() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
@@ -347,6 +347,8 @@ void FileVideoCaptureDevice::OnAllocateAndStart( |
DVLOG(1) << "Opened video file " << capture_format_.frame_size.ToString() |
<< ", fps: " << capture_format_.frame_rate; |
+ client_->OnStarted(); |
+ capture_ = true; |
capture_thread_.task_runner()->PostTask( |
FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask, |
@@ -355,6 +357,7 @@ void FileVideoCaptureDevice::OnAllocateAndStart( |
void FileVideoCaptureDevice::OnStopAndDeAllocate() { |
DCHECK(capture_thread_.task_runner()->BelongsToCurrentThread()); |
+ capture_ = false; |
file_parser_.reset(); |
client_.reset(); |
next_frame_time_ = base::TimeTicks(); |
@@ -362,7 +365,7 @@ void FileVideoCaptureDevice::OnStopAndDeAllocate() { |
void FileVideoCaptureDevice::OnCaptureTask() { |
DCHECK(capture_thread_.task_runner()->BelongsToCurrentThread()); |
- if (!client_) |
+ if (!client_ || !capture_) |
return; |
// Give the captured frame to the client. |