OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/capture/video/file_video_capture_device.h" | 5 #include "media/capture/video/file_video_capture_device.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 DCHECK(!file_parser_); | 341 DCHECK(!file_parser_); |
342 file_parser_ = GetVideoFileParser(file_path_, &capture_format_); | 342 file_parser_ = GetVideoFileParser(file_path_, &capture_format_); |
343 if (!file_parser_) { | 343 if (!file_parser_) { |
344 client_->OnError(FROM_HERE, "Could not open Video file"); | 344 client_->OnError(FROM_HERE, "Could not open Video file"); |
345 return; | 345 return; |
346 } | 346 } |
347 | 347 |
348 DVLOG(1) << "Opened video file " << capture_format_.frame_size.ToString() | 348 DVLOG(1) << "Opened video file " << capture_format_.frame_size.ToString() |
349 << ", fps: " << capture_format_.frame_rate; | 349 << ", fps: " << capture_format_.frame_rate; |
| 350 client_->OnStarted(); |
350 | 351 |
351 capture_thread_.task_runner()->PostTask( | 352 capture_thread_.task_runner()->PostTask( |
352 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask, | 353 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask, |
353 base::Unretained(this))); | 354 base::Unretained(this))); |
354 } | 355 } |
355 | 356 |
356 void FileVideoCaptureDevice::OnStopAndDeAllocate() { | 357 void FileVideoCaptureDevice::OnStopAndDeAllocate() { |
357 DCHECK(capture_thread_.task_runner()->BelongsToCurrentThread()); | 358 DCHECK(capture_thread_.task_runner()->BelongsToCurrentThread()); |
358 file_parser_.reset(); | 359 file_parser_.reset(); |
359 client_.reset(); | 360 client_.reset(); |
(...skipping 27 matching lines...) Expand all Loading... |
387 if (next_frame_time_ < current_time) | 388 if (next_frame_time_ < current_time) |
388 next_frame_time_ = current_time; | 389 next_frame_time_ = current_time; |
389 } | 390 } |
390 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 391 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
391 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask, | 392 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask, |
392 base::Unretained(this)), | 393 base::Unretained(this)), |
393 next_frame_time_ - current_time); | 394 next_frame_time_ - current_time); |
394 } | 395 } |
395 | 396 |
396 } // namespace media | 397 } // namespace media |
OLD | NEW |