| 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(configs.video_size.width(), |
| 112 configs.video_size.height()); |
| 113 } |
| 114 |
| 95 bool VideoDecoderJob::AreDemuxerConfigsChanged( | 115 bool VideoDecoderJob::AreDemuxerConfigsChanged( |
| 96 const DemuxerConfigs& configs) const { | 116 const DemuxerConfigs& configs) const { |
| 97 return video_codec_ != configs.video_codec || | 117 return video_codec_ != configs.video_codec || |
| 98 is_content_encrypted() != configs.is_video_encrypted || | 118 is_content_encrypted() != configs.is_video_encrypted || |
| 99 width_ != configs.video_size.width() || | 119 width_ != configs.video_size.width() || |
| 100 height_ != configs.video_size.height(); | 120 height_ != configs.video_size.height(); |
| 101 } | 121 } |
| 102 | 122 |
| 103 bool VideoDecoderJob::CreateMediaCodecBridgeInternal() { | 123 bool VideoDecoderJob::CreateMediaCodecBridgeInternal() { |
| 104 if (surface_.IsEmpty()) { | 124 if (surface_.IsEmpty()) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 132 void VideoDecoderJob::OnMediaCodecBridgeReleased() { | 152 void VideoDecoderJob::OnMediaCodecBridgeReleased() { |
| 133 release_resources_cb_.Run(); | 153 release_resources_cb_.Run(); |
| 134 } | 154 } |
| 135 | 155 |
| 136 bool VideoDecoderJob::IsProtectedSurfaceRequired() { | 156 bool VideoDecoderJob::IsProtectedSurfaceRequired() { |
| 137 return is_content_encrypted() && drm_bridge() && | 157 return is_content_encrypted() && drm_bridge() && |
| 138 drm_bridge()->IsProtectedSurfaceRequired(); | 158 drm_bridge()->IsProtectedSurfaceRequired(); |
| 139 } | 159 } |
| 140 | 160 |
| 141 } // namespace media | 161 } // namespace media |
| OLD | NEW |