| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 VideoDecoderJob* VideoDecoderJob::Create(const VideoCodec video_codec, | 27 VideoDecoderJob* VideoDecoderJob::Create(const VideoCodec video_codec, |
| 28 bool is_secure, | 28 bool is_secure, |
| 29 const gfx::Size& size, | 29 const gfx::Size& size, |
| 30 jobject surface, | 30 jobject surface, |
| 31 jobject media_crypto, | 31 jobject media_crypto, |
| 32 const base::Closure& request_data_cb) { | 32 const base::Closure& request_data_cb) { |
| 33 scoped_ptr<VideoCodecBridge> codec( | 33 scoped_ptr<VideoCodecBridge> codec(VideoCodecBridge::CreateDecoder( |
| 34 VideoCodecBridge::Create(video_codec, is_secure)); | 34 video_codec, is_secure, size, surface, media_crypto)); |
| 35 if (codec && codec->Start(video_codec, size, surface, media_crypto)) | 35 if (codec) return new VideoDecoderJob(codec.Pass(), request_data_cb); |
| 36 return new VideoDecoderJob(codec.Pass(), request_data_cb); | |
| 37 | 36 |
| 38 LOG(ERROR) << "Failed to create VideoDecoderJob."; | 37 LOG(ERROR) << "Failed to create VideoDecoderJob."; |
| 39 return NULL; | 38 return NULL; |
| 40 } | 39 } |
| 41 | 40 |
| 42 VideoDecoderJob::VideoDecoderJob( | 41 VideoDecoderJob::VideoDecoderJob( |
| 43 scoped_ptr<VideoCodecBridge> video_codec_bridge, | 42 scoped_ptr<VideoCodecBridge> video_codec_bridge, |
| 44 const base::Closure& request_data_cb) | 43 const base::Closure& request_data_cb) |
| 45 : MediaDecoderJob(g_video_decoder_thread.Pointer()->message_loop_proxy(), | 44 : MediaDecoderJob(g_video_decoder_thread.Pointer()->message_loop_proxy(), |
| 46 video_codec_bridge.get(), request_data_cb), | 45 video_codec_bridge.get(), request_data_cb), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 const ReleaseOutputCompletionCallback& callback) { | 56 const ReleaseOutputCompletionCallback& callback) { |
| 58 video_codec_bridge_->ReleaseOutputBuffer(output_buffer_index, render_output); | 57 video_codec_bridge_->ReleaseOutputBuffer(output_buffer_index, render_output); |
| 59 callback.Run(0u); | 58 callback.Run(0u); |
| 60 } | 59 } |
| 61 | 60 |
| 62 bool VideoDecoderJob::ComputeTimeToRender() const { | 61 bool VideoDecoderJob::ComputeTimeToRender() const { |
| 63 return true; | 62 return true; |
| 64 } | 63 } |
| 65 | 64 |
| 66 } // namespace media | 65 } // namespace media |
| OLD | NEW |