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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
9 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
10 #include "media/base/android/media_drm_bridge.h" | 12 #include "media/base/android/media_drm_bridge.h" |
11 #include "media/base/android/sdk_media_codec_bridge.h" | 13 #include "media/base/android/sdk_media_codec_bridge.h" |
12 | 14 |
13 namespace media { | 15 namespace media { |
14 | 16 |
15 class VideoDecoderThread : public base::Thread { | 17 class VideoDecoderThread : public base::Thread { |
16 public: | 18 public: |
(...skipping 25 matching lines...) Expand all Loading... |
42 | 44 |
43 bool VideoDecoderJob::SetVideoSurface(gfx::ScopedJavaSurface surface) { | 45 bool VideoDecoderJob::SetVideoSurface(gfx::ScopedJavaSurface surface) { |
44 // 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 |
45 // 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 |
46 // unprotected surface if the video content requires a protected one. | 48 // unprotected surface if the video content requires a protected one. |
47 if (!surface.IsEmpty() && IsProtectedSurfaceRequired() && | 49 if (!surface.IsEmpty() && IsProtectedSurfaceRequired() && |
48 !surface.is_protected()) { | 50 !surface.is_protected()) { |
49 return false; | 51 return false; |
50 } | 52 } |
51 | 53 |
52 surface_ = surface.Pass(); | 54 surface_ = std::move(surface); |
53 need_to_reconfig_decoder_job_ = true; | 55 need_to_reconfig_decoder_job_ = true; |
54 return true; | 56 return true; |
55 } | 57 } |
56 | 58 |
57 bool VideoDecoderJob::HasStream() const { | 59 bool VideoDecoderJob::HasStream() const { |
58 return video_codec_ != kUnknownVideoCodec; | 60 return video_codec_ != kUnknownVideoCodec; |
59 } | 61 } |
60 | 62 |
61 void VideoDecoderJob::ReleaseDecoderResources() { | 63 void VideoDecoderJob::ReleaseDecoderResources() { |
62 MediaDecoderJob::ReleaseDecoderResources(); | 64 MediaDecoderJob::ReleaseDecoderResources(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return (output_width_ != prev_output_width) || | 159 return (output_width_ != prev_output_width) || |
158 (output_height_ != prev_output_height); | 160 (output_height_ != prev_output_height); |
159 } | 161 } |
160 | 162 |
161 bool VideoDecoderJob::IsProtectedSurfaceRequired() { | 163 bool VideoDecoderJob::IsProtectedSurfaceRequired() { |
162 return is_content_encrypted() && drm_bridge() && | 164 return is_content_encrypted() && drm_bridge() && |
163 drm_bridge()->IsProtectedSurfaceRequired(); | 165 drm_bridge()->IsProtectedSurfaceRequired(); |
164 } | 166 } |
165 | 167 |
166 } // namespace media | 168 } // namespace media |
OLD | NEW |