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 "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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 void VideoDecoderJob::UpdateDemuxerConfigs(const DemuxerConfigs& configs) { | 88 void VideoDecoderJob::UpdateDemuxerConfigs(const DemuxerConfigs& configs) { |
| 89 video_codec_ = configs.video_codec; | 89 video_codec_ = configs.video_codec; |
| 90 width_ = configs.video_size.width(); | 90 width_ = configs.video_size.width(); |
| 91 height_ = configs.video_size.height(); | 91 height_ = configs.video_size.height(); |
| 92 set_is_content_encrypted(configs.is_video_encrypted); | 92 set_is_content_encrypted(configs.is_video_encrypted); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool VideoDecoderJob::IsCodecReconfigureNeeded( | |
| 96 const DemuxerConfigs& configs) const { | |
| 97 if (!media_codec_bridge_) | |
| 98 return true; | |
| 99 | |
| 100 if (!AreDemuxerConfigsChanged(configs)) | |
| 101 return false; | |
| 102 | |
| 103 bool only_size_changed = false; | |
| 104 if (video_codec_ == configs.video_codec && | |
| 105 is_content_encrypted() == configs.is_video_encrypted) { | |
| 106 only_size_changed = true; | |
| 107 } | |
| 108 | |
| 109 return !only_size_changed || | |
| 110 !static_cast<VideoCodecBridge*>(media_codec_bridge_.get())-> | |
| 111 IsAdaptivePlaybackSupported(width_, height_); | |
|
wolenetz
2014/06/06 23:28:07
s/width_/configs.video_size.width()/
s/height_/con
qinmin
2014/06/07 01:31:55
Done. A stupid mistake :(
| |
| 112 } | |
| 113 | |
| 95 bool VideoDecoderJob::AreDemuxerConfigsChanged( | 114 bool VideoDecoderJob::AreDemuxerConfigsChanged( |
| 96 const DemuxerConfigs& configs) const { | 115 const DemuxerConfigs& configs) const { |
| 97 return video_codec_ != configs.video_codec || | 116 return video_codec_ != configs.video_codec || |
| 98 is_content_encrypted() != configs.is_video_encrypted || | 117 is_content_encrypted() != configs.is_video_encrypted || |
| 99 width_ != configs.video_size.width() || | 118 width_ != configs.video_size.width() || |
| 100 height_ != configs.video_size.height(); | 119 height_ != configs.video_size.height(); |
| 101 } | 120 } |
| 102 | 121 |
| 103 bool VideoDecoderJob::CreateMediaCodecBridgeInternal() { | 122 bool VideoDecoderJob::CreateMediaCodecBridgeInternal() { |
| 104 if (surface_.IsEmpty()) { | 123 if (surface_.IsEmpty()) { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 132 void VideoDecoderJob::OnMediaCodecBridgeReleased() { | 151 void VideoDecoderJob::OnMediaCodecBridgeReleased() { |
| 133 release_resources_cb_.Run(); | 152 release_resources_cb_.Run(); |
| 134 } | 153 } |
| 135 | 154 |
| 136 bool VideoDecoderJob::IsProtectedSurfaceRequired() { | 155 bool VideoDecoderJob::IsProtectedSurfaceRequired() { |
| 137 return is_content_encrypted() && drm_bridge() && | 156 return is_content_encrypted() && drm_bridge() && |
| 138 drm_bridge()->IsProtectedSurfaceRequired(); | 157 drm_bridge()->IsProtectedSurfaceRequired(); |
| 139 } | 158 } |
| 140 | 159 |
| 141 } // namespace media | 160 } // namespace media |
| OLD | NEW |