Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 } | 130 } |
| 131 | 131 |
| 132 // If we cannot find a key frame in cache, browser seek is needed. | 132 // If we cannot find a key frame in cache, browser seek is needed. |
| 133 bool next_video_data_is_iframe = SetCurrentFrameToPreviouslyCachedKeyFrame(); | 133 bool next_video_data_is_iframe = SetCurrentFrameToPreviouslyCachedKeyFrame(); |
| 134 if (!next_video_data_is_iframe) | 134 if (!next_video_data_is_iframe) |
| 135 return STATUS_KEY_FRAME_REQUIRED; | 135 return STATUS_KEY_FRAME_REQUIRED; |
| 136 | 136 |
| 137 bool is_secure = is_content_encrypted() && drm_bridge() && | 137 bool is_secure = is_content_encrypted() && drm_bridge() && |
| 138 drm_bridge()->IsProtectedSurfaceRequired(); | 138 drm_bridge()->IsProtectedSurfaceRequired(); |
| 139 | 139 |
| 140 const std::vector<uint8_t> csd; | |
|
sandersd (OOO until July 31)
2016/09/27 20:03:16
empty_csd?
watk
2016/09/27 21:44:36
Done.
| |
| 140 media_codec_bridge_.reset(VideoCodecBridge::CreateDecoder( | 141 media_codec_bridge_.reset(VideoCodecBridge::CreateDecoder( |
| 141 video_codec_, is_secure, gfx::Size(config_width_, config_height_), | 142 video_codec_, is_secure, gfx::Size(config_width_, config_height_), |
| 142 surface_.j_surface().obj(), GetMediaCrypto())); | 143 surface_.j_surface().obj(), GetMediaCrypto(), csd, csd)); |
| 143 | 144 |
| 144 if (!media_codec_bridge_) | 145 if (!media_codec_bridge_) |
| 145 return STATUS_FAILURE; | 146 return STATUS_FAILURE; |
| 146 | 147 |
| 147 return STATUS_SUCCESS; | 148 return STATUS_SUCCESS; |
| 148 } | 149 } |
| 149 | 150 |
| 150 bool VideoDecoderJob::UpdateOutputFormat() { | 151 bool VideoDecoderJob::UpdateOutputFormat() { |
| 151 if (!media_codec_bridge_) | 152 if (!media_codec_bridge_) |
| 152 return false; | 153 return false; |
| 153 int prev_output_width = output_width_; | 154 int prev_output_width = output_width_; |
| 154 int prev_output_height = output_height_; | 155 int prev_output_height = output_height_; |
| 155 // See b/18224769. The values reported from MediaCodecBridge::GetOutputSize | 156 // See b/18224769. The values reported from MediaCodecBridge::GetOutputSize |
| 156 // correspond to the actual video frame size, but this is not necessarily the | 157 // correspond to the actual video frame size, but this is not necessarily the |
| 157 // size that should be output. | 158 // size that should be output. |
| 158 output_width_ = config_width_; | 159 output_width_ = config_width_; |
| 159 output_height_ = config_height_; | 160 output_height_ = config_height_; |
| 160 return (output_width_ != prev_output_width) || | 161 return (output_width_ != prev_output_width) || |
| 161 (output_height_ != prev_output_height); | 162 (output_height_ != prev_output_height); |
| 162 } | 163 } |
| 163 | 164 |
| 164 bool VideoDecoderJob::IsProtectedSurfaceRequired() { | 165 bool VideoDecoderJob::IsProtectedSurfaceRequired() { |
| 165 return is_content_encrypted() && drm_bridge() && | 166 return is_content_encrypted() && drm_bridge() && |
| 166 drm_bridge()->IsProtectedSurfaceRequired(); | 167 drm_bridge()->IsProtectedSurfaceRequired(); |
| 167 } | 168 } |
| 168 | 169 |
| 169 } // namespace media | 170 } // namespace media |
| OLD | NEW |