OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include "media/base/android/media_codec_decoder.h" | 9 #include "media/base/android/media_codec_decoder.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // update_current_time_cb: callback that reports current playback time. | 23 // update_current_time_cb: callback that reports current playback time. |
24 // Called for released output frame, | 24 // Called for released output frame, |
25 // video_size_changed_cb: reports the new video size, | 25 // video_size_changed_cb: reports the new video size, |
26 // codec_created_cb: reports that video codec has been created. A controller | 26 // codec_created_cb: reports that video codec has been created. A controller |
27 // class might use it to release more resources so that this | 27 // class might use it to release more resources so that this |
28 // decoder can use them. | 28 // decoder can use them. |
29 MediaCodecVideoDecoder( | 29 MediaCodecVideoDecoder( |
30 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, | 30 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, |
31 const base::Closure& request_data_cb, | 31 const base::Closure& request_data_cb, |
32 const base::Closure& starvation_cb, | 32 const base::Closure& starvation_cb, |
| 33 const base::Closure& preroll_done_cb, |
33 const base::Closure& stop_done_cb, | 34 const base::Closure& stop_done_cb, |
34 const base::Closure& error_cb, | 35 const base::Closure& error_cb, |
35 const SetTimeCallback& update_current_time_cb, | 36 const SetTimeCallback& update_current_time_cb, |
36 const VideoSizeChangedCallback& video_size_changed_cb, | 37 const VideoSizeChangedCallback& video_size_changed_cb, |
37 const base::Closure& codec_created_cb); | 38 const base::Closure& codec_created_cb); |
38 ~MediaCodecVideoDecoder() override; | 39 ~MediaCodecVideoDecoder() override; |
39 | 40 |
40 const char* class_name() const override; | 41 const char* class_name() const override; |
41 | 42 |
42 bool HasStream() const override; | 43 bool HasStream() const override; |
43 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; | 44 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; |
44 void ReleaseDecoderResources() override; | 45 void ReleaseDecoderResources() override; |
| 46 void ReleaseMediaCodec() override; |
45 | 47 |
46 // Stores the video surface to use with upcoming Configure() | 48 // Stores the video surface to use with upcoming Configure() |
47 void SetVideoSurface(gfx::ScopedJavaSurface surface); | 49 void SetVideoSurface(gfx::ScopedJavaSurface surface); |
48 | 50 |
49 // Returns true if there is a video surface to use. | 51 // Returns true if there is a video surface to use. |
50 bool HasVideoSurface() const; | 52 bool HasVideoSurface() const; |
51 | 53 |
52 protected: | 54 protected: |
53 bool IsCodecReconfigureNeeded(const DemuxerConfigs& curr, | 55 bool IsCodecReconfigureNeeded(const DemuxerConfigs& curr, |
54 const DemuxerConfigs& next) const override; | 56 const DemuxerConfigs& next) const override; |
55 ConfigStatus ConfigureInternal() override; | 57 ConfigStatus ConfigureInternal() override; |
56 void SynchronizePTSWithTime(base::TimeDelta current_time) override; | 58 void AssociateCurrentTimeWithPTS(base::TimeDelta pts) override; |
| 59 void DissociatePTSFromTime() override; |
57 void OnOutputFormatChanged() override; | 60 void OnOutputFormatChanged() override; |
58 void Render(int buffer_index, | 61 void Render(int buffer_index, |
59 size_t size, | 62 size_t size, |
60 bool render_output, | 63 RenderMode render_mode, |
61 base::TimeDelta pts, | 64 base::TimeDelta pts, |
62 bool eos_encountered) override; | 65 bool eos_encountered) override; |
63 | 66 |
64 int NumDelayedRenderTasks() const override; | 67 int NumDelayedRenderTasks() const override; |
65 void ClearDelayedBuffers(bool release) override; | 68 void ReleaseDelayedBuffers() override; |
66 | 69 |
67 #ifndef NDEBUG | 70 #ifndef NDEBUG |
68 void VerifyUnitIsKeyFrame(const AccessUnit* unit) const override; | 71 void VerifyUnitIsKeyFrame(const AccessUnit* unit) const override; |
69 #endif | 72 #endif |
70 | 73 |
71 private: | 74 private: |
72 // A helper method that releases output buffers and does | 75 // A helper method that releases output buffers and does |
73 // post-release checks. Might be called by Render() or posted | 76 // post-release checks. Might be called by Render() or posted |
74 // for later execution. | 77 // for later execution. |
75 void ReleaseOutputBuffer(int buffer_index, | 78 void ReleaseOutputBuffer(int buffer_index, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 110 |
108 // Mantain the last seen PTS for stand-alone EOS. | 111 // Mantain the last seen PTS for stand-alone EOS. |
109 base::TimeDelta last_seen_pts_; | 112 base::TimeDelta last_seen_pts_; |
110 | 113 |
111 DISALLOW_COPY_AND_ASSIGN(MediaCodecVideoDecoder); | 114 DISALLOW_COPY_AND_ASSIGN(MediaCodecVideoDecoder); |
112 }; | 115 }; |
113 | 116 |
114 } // namespace media | 117 } // namespace media |
115 | 118 |
116 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ | 119 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
OLD | NEW |