OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_player.h" | 5 #include "media/base/android/media_codec_player.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/thread_task_runner_handle.h" |
10 | 11 |
11 #define RUN_ON_MEDIA_THREAD(METHOD, ...) \ | 12 #define RUN_ON_MEDIA_THREAD(METHOD, ...) \ |
12 do { \ | 13 do { \ |
13 if (!GetMediaTaskRunner()->BelongsToCurrentThread()) { \ | 14 if (!GetMediaTaskRunner()->BelongsToCurrentThread()) { \ |
14 GetMediaTaskRunner()->PostTask( \ | 15 GetMediaTaskRunner()->PostTask( \ |
15 FROM_HERE, \ | 16 FROM_HERE, \ |
16 base::Bind(&MediaCodecPlayer:: METHOD, weak_this_, ##__VA_ARGS__)); \ | 17 base::Bind(&MediaCodecPlayer:: METHOD, weak_this_, ##__VA_ARGS__)); \ |
17 return; \ | 18 return; \ |
18 } \ | 19 } \ |
19 } while(0) | 20 } while(0) |
(...skipping 22 matching lines...) Expand all Loading... |
42 MediaCodecPlayer::MediaCodecPlayer( | 43 MediaCodecPlayer::MediaCodecPlayer( |
43 int player_id, | 44 int player_id, |
44 MediaPlayerManager* manager, | 45 MediaPlayerManager* manager, |
45 const RequestMediaResourcesCB& request_media_resources_cb, | 46 const RequestMediaResourcesCB& request_media_resources_cb, |
46 scoped_ptr<DemuxerAndroid> demuxer, | 47 scoped_ptr<DemuxerAndroid> demuxer, |
47 const GURL& frame_url) | 48 const GURL& frame_url) |
48 : MediaPlayerAndroid(player_id, | 49 : MediaPlayerAndroid(player_id, |
49 manager, | 50 manager, |
50 request_media_resources_cb, | 51 request_media_resources_cb, |
51 frame_url), | 52 frame_url), |
52 ui_task_runner_(base::MessageLoopProxy::current()), | 53 ui_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
53 demuxer_(demuxer.Pass()), | 54 demuxer_(demuxer.Pass()), |
54 weak_factory_(this) { | 55 weak_factory_(this) { |
55 // UI thread | 56 // UI thread |
56 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 57 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
57 | 58 |
58 DVLOG(1) << "MediaCodecPlayer::MediaCodecPlayer: player_id:" << player_id; | 59 DVLOG(1) << "MediaCodecPlayer::MediaCodecPlayer: player_id:" << player_id; |
59 | 60 |
60 weak_this_ = weak_factory_.GetWeakPtr(); | 61 weak_this_ = weak_factory_.GetWeakPtr(); |
61 | 62 |
62 // Finish initializaton on Media thread | 63 // Finish initializaton on Media thread |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 244 } |
244 | 245 |
245 void MediaCodecPlayer::OnDemuxerDurationChanged( | 246 void MediaCodecPlayer::OnDemuxerDurationChanged( |
246 base::TimeDelta duration) { | 247 base::TimeDelta duration) { |
247 // Media thread | 248 // Media thread |
248 DCHECK(GetMediaTaskRunner()->BelongsToCurrentThread()); | 249 DCHECK(GetMediaTaskRunner()->BelongsToCurrentThread()); |
249 NOTIMPLEMENTED(); | 250 NOTIMPLEMENTED(); |
250 } | 251 } |
251 | 252 |
252 } // namespace media | 253 } // namespace media |
OLD | NEW |