| 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_drm_bridge.h" | 10 #include "media/base/android/media_drm_bridge.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // If we cannot find a key frame in cache, browser seek is needed. | 129 // If we cannot find a key frame in cache, browser seek is needed. |
| 130 bool next_video_data_is_iframe = SetCurrentFrameToPreviouslyCachedKeyFrame(); | 130 bool next_video_data_is_iframe = SetCurrentFrameToPreviouslyCachedKeyFrame(); |
| 131 if (!next_video_data_is_iframe) | 131 if (!next_video_data_is_iframe) |
| 132 return STATUS_KEY_FRAME_REQUIRED; | 132 return STATUS_KEY_FRAME_REQUIRED; |
| 133 | 133 |
| 134 bool is_secure = is_content_encrypted() && drm_bridge() && | 134 bool is_secure = is_content_encrypted() && drm_bridge() && |
| 135 drm_bridge()->IsProtectedSurfaceRequired(); | 135 drm_bridge()->IsProtectedSurfaceRequired(); |
| 136 | 136 |
| 137 media_codec_bridge_.reset(VideoCodecBridge::CreateDecoder( | 137 media_codec_bridge_.reset(VideoCodecBridge::CreateDecoder( |
| 138 video_codec_, is_secure, gfx::Size(config_width_, config_height_), | 138 video_codec_, is_secure, gfx::Size(config_width_, config_height_), |
| 139 surface_.j_surface().obj(), GetMediaCrypto().obj())); | 139 surface_.j_surface().obj(), GetMediaCrypto())); |
| 140 | 140 |
| 141 if (!media_codec_bridge_) | 141 if (!media_codec_bridge_) |
| 142 return STATUS_FAILURE; | 142 return STATUS_FAILURE; |
| 143 | 143 |
| 144 return STATUS_SUCCESS; | 144 return STATUS_SUCCESS; |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool VideoDecoderJob::UpdateOutputFormat() { | 147 bool VideoDecoderJob::UpdateOutputFormat() { |
| 148 if (!media_codec_bridge_) | 148 if (!media_codec_bridge_) |
| 149 return false; | 149 return false; |
| 150 int prev_output_width = output_width_; | 150 int prev_output_width = output_width_; |
| 151 int prev_output_height = output_height_; | 151 int prev_output_height = output_height_; |
| 152 // See b/18224769. The values reported from MediaCodecBridge::GetOutputFormat | 152 // See b/18224769. The values reported from MediaCodecBridge::GetOutputFormat |
| 153 // correspond to the actual video frame size, but this is not necessarily the | 153 // correspond to the actual video frame size, but this is not necessarily the |
| 154 // size that should be output. | 154 // size that should be output. |
| 155 output_width_ = config_width_; | 155 output_width_ = config_width_; |
| 156 output_height_ = config_height_; | 156 output_height_ = config_height_; |
| 157 return (output_width_ != prev_output_width) || | 157 return (output_width_ != prev_output_width) || |
| 158 (output_height_ != prev_output_height); | 158 (output_height_ != prev_output_height); |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool VideoDecoderJob::IsProtectedSurfaceRequired() { | 161 bool VideoDecoderJob::IsProtectedSurfaceRequired() { |
| 162 return is_content_encrypted() && drm_bridge() && | 162 return is_content_encrypted() && drm_bridge() && |
| 163 drm_bridge()->IsProtectedSurfaceRequired(); | 163 drm_bridge()->IsProtectedSurfaceRequired(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace media | 166 } // namespace media |
| OLD | NEW |