OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/base/android/media_codec_loop.h" | 5 #include "media/base/android/media_codec_loop.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 presentation_time(other.presentation_time), | 32 presentation_time(other.presentation_time), |
33 is_eos(other.is_eos), | 33 is_eos(other.is_eos), |
34 encryption_scheme(other.encryption_scheme) {} | 34 encryption_scheme(other.encryption_scheme) {} |
35 | 35 |
36 MediaCodecLoop::InputData::~InputData() {} | 36 MediaCodecLoop::InputData::~InputData() {} |
37 | 37 |
38 MediaCodecLoop::MediaCodecLoop( | 38 MediaCodecLoop::MediaCodecLoop( |
39 int sdk_int, | 39 int sdk_int, |
40 Client* client, | 40 Client* client, |
41 std::unique_ptr<MediaCodecBridge> media_codec, | 41 std::unique_ptr<MediaCodecBridge> media_codec, |
42 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 42 scoped_refptr<base::SingleThreadTaskRunner> timer_task_runner) |
43 : state_(STATE_READY), | 43 : state_(STATE_READY), |
44 client_(client), | 44 client_(client), |
45 media_codec_(std::move(media_codec)), | 45 media_codec_(std::move(media_codec)), |
46 pending_input_buf_index_(kInvalidBufferIndex), | 46 pending_input_buf_index_(kInvalidBufferIndex), |
47 sdk_int_(sdk_int), | 47 sdk_int_(sdk_int), |
48 weak_factory_(this) { | 48 weak_factory_(this) { |
49 if (task_runner) | 49 if (timer_task_runner) |
50 io_timer_.SetTaskRunner(task_runner); | 50 io_timer_.SetTaskRunner(timer_task_runner); |
51 // TODO(liberato): should this DCHECK? | 51 // TODO(liberato): should this DCHECK? |
52 if (media_codec_ == nullptr) | 52 if (media_codec_ == nullptr) |
53 SetState(STATE_ERROR); | 53 SetState(STATE_ERROR); |
54 } | 54 } |
55 | 55 |
56 MediaCodecLoop::~MediaCodecLoop() { | 56 MediaCodecLoop::~MediaCodecLoop() { |
57 io_timer_.Stop(); | 57 io_timer_.Stop(); |
58 } | 58 } |
59 | 59 |
60 void MediaCodecLoop::SetTestTickClock(base::TickClock* test_tick_clock) { | 60 void MediaCodecLoop::SetTestTickClock(base::TickClock* test_tick_clock) { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 RETURN_STRING(STATE_DRAINED); | 361 RETURN_STRING(STATE_DRAINED); |
362 RETURN_STRING(STATE_ERROR); | 362 RETURN_STRING(STATE_ERROR); |
363 } | 363 } |
364 #undef RETURN_STRING | 364 #undef RETURN_STRING |
365 | 365 |
366 NOTREACHED() << "Unknown state " << state; | 366 NOTREACHED() << "Unknown state " << state; |
367 return nullptr; | 367 return nullptr; |
368 } | 368 } |
369 | 369 |
370 } // namespace media | 370 } // namespace media |
OLD | NEW |