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 24 matching lines...) Expand all Loading... |
35 on_demuxer_config_changed_cb), | 35 on_demuxer_config_changed_cb), |
36 video_codec_(kUnknownVideoCodec), | 36 video_codec_(kUnknownVideoCodec), |
37 config_width_(0), | 37 config_width_(0), |
38 config_height_(0), | 38 config_height_(0), |
39 output_width_(0), | 39 output_width_(0), |
40 output_height_(0) { | 40 output_height_(0) { |
41 } | 41 } |
42 | 42 |
43 VideoDecoderJob::~VideoDecoderJob() {} | 43 VideoDecoderJob::~VideoDecoderJob() {} |
44 | 44 |
45 bool VideoDecoderJob::SetVideoSurface(gfx::ScopedJavaSurface surface) { | 45 bool VideoDecoderJob::SetVideoSurface(gl::ScopedJavaSurface surface) { |
46 // For an empty surface, always pass it to the |media_codec_bridge_| job so | 46 // For an empty surface, always pass it to the |media_codec_bridge_| job so |
47 // that it can detach from the current one. Otherwise, don't pass an | 47 // that it can detach from the current one. Otherwise, don't pass an |
48 // unprotected surface if the video content requires a protected one. | 48 // unprotected surface if the video content requires a protected one. |
49 if (!surface.IsEmpty() && IsProtectedSurfaceRequired() && | 49 if (!surface.IsEmpty() && IsProtectedSurfaceRequired() && |
50 !surface.is_protected()) { | 50 !surface.is_protected()) { |
51 return false; | 51 return false; |
52 } | 52 } |
53 | 53 |
54 surface_ = std::move(surface); | 54 surface_ = std::move(surface); |
55 need_to_reconfig_decoder_job_ = true; | 55 need_to_reconfig_decoder_job_ = true; |
56 return true; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 bool VideoDecoderJob::HasStream() const { | 59 bool VideoDecoderJob::HasStream() const { |
60 return video_codec_ != kUnknownVideoCodec; | 60 return video_codec_ != kUnknownVideoCodec; |
61 } | 61 } |
62 | 62 |
63 void VideoDecoderJob::ReleaseDecoderResources() { | 63 void VideoDecoderJob::ReleaseDecoderResources() { |
64 MediaDecoderJob::ReleaseDecoderResources(); | 64 MediaDecoderJob::ReleaseDecoderResources(); |
65 surface_ = gfx::ScopedJavaSurface(); | 65 surface_ = gl::ScopedJavaSurface(); |
66 } | 66 } |
67 | 67 |
68 void VideoDecoderJob::SetDemuxerConfigs(const DemuxerConfigs& configs) { | 68 void VideoDecoderJob::SetDemuxerConfigs(const DemuxerConfigs& configs) { |
69 video_codec_ = configs.video_codec; | 69 video_codec_ = configs.video_codec; |
70 config_width_ = configs.video_size.width(); | 70 config_width_ = configs.video_size.width(); |
71 config_height_ = configs.video_size.height(); | 71 config_height_ = configs.video_size.height(); |
72 set_is_content_encrypted(configs.is_video_encrypted); | 72 set_is_content_encrypted(configs.is_video_encrypted); |
73 if (!media_codec_bridge_) { | 73 if (!media_codec_bridge_) { |
74 output_width_ = config_width_; | 74 output_width_ = config_width_; |
75 output_height_ = config_height_; | 75 output_height_ = config_height_; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return (output_width_ != prev_output_width) || | 160 return (output_width_ != prev_output_width) || |
161 (output_height_ != prev_output_height); | 161 (output_height_ != prev_output_height); |
162 } | 162 } |
163 | 163 |
164 bool VideoDecoderJob::IsProtectedSurfaceRequired() { | 164 bool VideoDecoderJob::IsProtectedSurfaceRequired() { |
165 return is_content_encrypted() && drm_bridge() && | 165 return is_content_encrypted() && drm_bridge() && |
166 drm_bridge()->IsProtectedSurfaceRequired(); | 166 drm_bridge()->IsProtectedSurfaceRequired(); |
167 } | 167 } |
168 | 168 |
169 } // namespace media | 169 } // namespace media |
OLD | NEW |