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