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/base/android/video_decoder_job.h" | 5 #include "media/base/android/video_decoder_job.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/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "media/base/android/media_codec_bridge.h" | 10 #include "media/base/android/media_codec_bridge.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 class VideoDecoderThread : public base::Thread { | 14 class VideoDecoderThread : public base::Thread { |
15 public: | 15 public: |
16 VideoDecoderThread() : base::Thread("MediaSource_VideoDecoderThread") { | 16 VideoDecoderThread() : base::Thread("MediaSource_VideoDecoderThread") { |
17 Start(); | 17 Start(); |
18 } | 18 } |
19 }; | 19 }; |
20 | 20 |
21 // TODO(qinmin): Check if it is tolerable to use worker pool to handle all the | 21 // TODO(qinmin): Check if it is tolerable to use worker pool to handle all the |
22 // decoding tasks so that we don't need a global thread here. | 22 // decoding tasks so that we don't need a global thread here. |
23 // http://crbug.com/245750 | 23 // http://crbug.com/245750 |
24 base::LazyInstance<VideoDecoderThread>::Leaky | 24 base::LazyInstance<VideoDecoderThread>::Leaky |
25 g_video_decoder_thread = LAZY_INSTANCE_INITIALIZER; | 25 g_video_decoder_thread = LAZY_INSTANCE_INITIALIZER; |
26 | 26 |
27 | 27 VideoDecoderJob* VideoDecoderJob::Create(const VideoCodec video_codec, |
28 VideoDecoderJob* VideoDecoderJob::Create( | 28 bool is_secure, |
29 const VideoCodec video_codec, const gfx::Size& size, jobject surface, | 29 const gfx::Size& size, |
30 jobject media_crypto, const base::Closure& request_data_cb) { | 30 jobject surface, |
31 scoped_ptr<VideoCodecBridge> codec(VideoCodecBridge::Create(video_codec)); | 31 jobject media_crypto, |
| 32 const base::Closure& request_data_cb) { |
| 33 scoped_ptr<VideoCodecBridge> codec( |
| 34 VideoCodecBridge::Create(video_codec, is_secure)); |
32 if (codec && codec->Start(video_codec, size, surface, media_crypto)) | 35 if (codec && codec->Start(video_codec, size, surface, media_crypto)) |
33 return new VideoDecoderJob(codec.Pass(), request_data_cb); | 36 return new VideoDecoderJob(codec.Pass(), request_data_cb); |
34 return NULL; | 37 return NULL; |
35 } | 38 } |
36 | 39 |
37 VideoDecoderJob::VideoDecoderJob( | 40 VideoDecoderJob::VideoDecoderJob( |
38 scoped_ptr<VideoCodecBridge> video_codec_bridge, | 41 scoped_ptr<VideoCodecBridge> video_codec_bridge, |
39 const base::Closure& request_data_cb) | 42 const base::Closure& request_data_cb) |
40 : MediaDecoderJob(g_video_decoder_thread.Pointer()->message_loop_proxy(), | 43 : MediaDecoderJob(g_video_decoder_thread.Pointer()->message_loop_proxy(), |
41 video_codec_bridge.get(), request_data_cb), | 44 video_codec_bridge.get(), request_data_cb), |
(...skipping 12 matching lines...) Expand all Loading... |
54 video_codec_bridge_->ReleaseOutputBuffer(outputBufferIndex, true); | 57 video_codec_bridge_->ReleaseOutputBuffer(outputBufferIndex, true); |
55 | 58 |
56 callback.Run(status, presentation_timestamp, 0); | 59 callback.Run(status, presentation_timestamp, 0); |
57 } | 60 } |
58 | 61 |
59 bool VideoDecoderJob::ComputeTimeToRender() const { | 62 bool VideoDecoderJob::ComputeTimeToRender() const { |
60 return true; | 63 return true; |
61 } | 64 } |
62 | 65 |
63 } // namespace media | 66 } // namespace media |
OLD | NEW |