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

Side by Side Diff: media/capture/video/file_video_capture_device.cc

Issue 2086353002: Remove calls to deprecated MessageLoop methods in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 CHECK(!capture_thread_.IsRunning()); 306 CHECK(!capture_thread_.IsRunning());
307 } 307 }
308 308
309 void FileVideoCaptureDevice::AllocateAndStart( 309 void FileVideoCaptureDevice::AllocateAndStart(
310 const VideoCaptureParams& params, 310 const VideoCaptureParams& params,
311 std::unique_ptr<VideoCaptureDevice::Client> client) { 311 std::unique_ptr<VideoCaptureDevice::Client> client) {
312 DCHECK(thread_checker_.CalledOnValidThread()); 312 DCHECK(thread_checker_.CalledOnValidThread());
313 CHECK(!capture_thread_.IsRunning()); 313 CHECK(!capture_thread_.IsRunning());
314 314
315 capture_thread_.Start(); 315 capture_thread_.Start();
316 capture_thread_.message_loop()->PostTask( 316 capture_thread_.task_runner()->PostTask(
317 FROM_HERE, 317 FROM_HERE,
318 base::Bind(&FileVideoCaptureDevice::OnAllocateAndStart, 318 base::Bind(&FileVideoCaptureDevice::OnAllocateAndStart,
319 base::Unretained(this), params, base::Passed(&client))); 319 base::Unretained(this), params, base::Passed(&client)));
320 } 320 }
321 321
322 void FileVideoCaptureDevice::StopAndDeAllocate() { 322 void FileVideoCaptureDevice::StopAndDeAllocate() {
323 DCHECK(thread_checker_.CalledOnValidThread()); 323 DCHECK(thread_checker_.CalledOnValidThread());
324 CHECK(capture_thread_.IsRunning()); 324 CHECK(capture_thread_.IsRunning());
325 325
326 capture_thread_.message_loop()->PostTask( 326 capture_thread_.task_runner()->PostTask(
327 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnStopAndDeAllocate, 327 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnStopAndDeAllocate,
328 base::Unretained(this))); 328 base::Unretained(this)));
329 capture_thread_.Stop(); 329 capture_thread_.Stop();
330 } 330 }
331 331
332 void FileVideoCaptureDevice::OnAllocateAndStart( 332 void FileVideoCaptureDevice::OnAllocateAndStart(
333 const VideoCaptureParams& params, 333 const VideoCaptureParams& params,
334 std::unique_ptr<VideoCaptureDevice::Client> client) { 334 std::unique_ptr<VideoCaptureDevice::Client> client) {
335 DCHECK_EQ(capture_thread_.message_loop(), base::MessageLoop::current()); 335 DCHECK_EQ(capture_thread_.message_loop(), base::MessageLoop::current());
336 336
337 client_ = std::move(client); 337 client_ = std::move(client);
338 338
339 DCHECK(!file_parser_); 339 DCHECK(!file_parser_);
340 file_parser_ = GetVideoFileParser(file_path_, &capture_format_); 340 file_parser_ = GetVideoFileParser(file_path_, &capture_format_);
341 if (!file_parser_) { 341 if (!file_parser_) {
342 client_->OnError(FROM_HERE, "Could not open Video file"); 342 client_->OnError(FROM_HERE, "Could not open Video file");
343 return; 343 return;
344 } 344 }
345 345
346 DVLOG(1) << "Opened video file " << capture_format_.frame_size.ToString() 346 DVLOG(1) << "Opened video file " << capture_format_.frame_size.ToString()
347 << ", fps: " << capture_format_.frame_rate; 347 << ", fps: " << capture_format_.frame_rate;
348 348
349 capture_thread_.message_loop()->PostTask( 349 capture_thread_.task_runner()->PostTask(
350 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask, 350 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask,
351 base::Unretained(this))); 351 base::Unretained(this)));
352 } 352 }
353 353
354 void FileVideoCaptureDevice::OnStopAndDeAllocate() { 354 void FileVideoCaptureDevice::OnStopAndDeAllocate() {
355 DCHECK_EQ(capture_thread_.message_loop(), base::MessageLoop::current()); 355 DCHECK_EQ(capture_thread_.message_loop(), base::MessageLoop::current());
356 file_parser_.reset(); 356 file_parser_.reset();
357 client_.reset(); 357 client_.reset();
358 next_frame_time_ = base::TimeTicks(); 358 next_frame_time_ = base::TimeTicks();
359 } 359 }
(...skipping 25 matching lines...) Expand all
385 if (next_frame_time_ < current_time) 385 if (next_frame_time_ < current_time)
386 next_frame_time_ = current_time; 386 next_frame_time_ = current_time;
387 } 387 }
388 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 388 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
389 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask, 389 FROM_HERE, base::Bind(&FileVideoCaptureDevice::OnCaptureTask,
390 base::Unretained(this)), 390 base::Unretained(this)),
391 next_frame_time_ - current_time); 391 next_frame_time_ - current_time);
392 } 392 }
393 393
394 } // namespace media 394 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl_unittest.cc ('k') | media/cast/sender/h264_vt_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698