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_AUDIO_DECODER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_AUDIO_DECODER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_AUDIO_DECODER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_AUDIO_DECODER_H_ |
7 | 7 |
8 #include "media/base/android/media_codec_decoder.h" | 8 #include "media/base/android/media_codec_decoder.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
11 | 11 |
12 class AudioTimestampHelper; | 12 class AudioTimestampHelper; |
13 | 13 |
14 // Audio decoder for MediaCodecPlayer | 14 // Audio decoder for MediaCodecPlayer |
15 class MediaCodecAudioDecoder : public MediaCodecDecoder { | 15 class MediaCodecAudioDecoder : public MediaCodecDecoder { |
16 public: | 16 public: |
17 // For parameters see media_codec_decoder.h | 17 // For parameters see media_codec_decoder.h |
18 // update_current_time_cb: callback that reports current playback time. | 18 // update_current_time_cb: callback that reports current playback time. |
19 // Called for each rendered frame. | 19 // Called for each rendered frame. |
20 MediaCodecAudioDecoder( | 20 MediaCodecAudioDecoder( |
21 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, | 21 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, |
22 const base::Closure& request_data_cb, | 22 const base::Closure& request_data_cb, |
23 const base::Closure& starvation_cb, | 23 const base::Closure& starvation_cb, |
24 const base::Closure& decoder_drained_cb, | 24 const base::Closure& decoder_drained_cb, |
25 const base::Closure& stop_done_cb, | 25 const base::Closure& stop_done_cb, |
26 const base::Closure& key_required_cb, | 26 const base::Closure& key_required_cb, |
27 const base::Closure& error_cb, | 27 const base::Closure& error_cb, |
28 const SetTimeCallback& update_current_time_cb); | 28 const SetTimeCallback& update_current_time_cb, |
| 29 FrameStatistics* frame_statistics); |
29 ~MediaCodecAudioDecoder() override; | 30 ~MediaCodecAudioDecoder() override; |
30 | 31 |
31 const char* class_name() const override; | 32 const char* class_name() const override; |
32 | 33 |
33 bool HasStream() const override; | 34 bool HasStream() const override; |
34 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; | 35 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; |
35 bool IsContentEncrypted() const override; | 36 bool IsContentEncrypted() const override; |
36 void ReleaseDecoderResources() override; | 37 void ReleaseDecoderResources() override; |
37 void Flush() override; | 38 void Flush() override; |
38 | 39 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 81 |
81 // Base timestamp for the |audio_timestamp_helper_|. | 82 // Base timestamp for the |audio_timestamp_helper_|. |
82 base::TimeDelta base_timestamp_; | 83 base::TimeDelta base_timestamp_; |
83 | 84 |
84 // Object to calculate the current audio timestamp for A/V sync. | 85 // Object to calculate the current audio timestamp for A/V sync. |
85 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; | 86 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; |
86 | 87 |
87 // Reports current playback time to the callee. | 88 // Reports current playback time to the callee. |
88 SetTimeCallback update_current_time_cb_; | 89 SetTimeCallback update_current_time_cb_; |
89 | 90 |
| 91 // The time limit for the next frame to avoid underrun. |
| 92 base::TimeTicks next_frame_time_limit_; |
| 93 |
90 DISALLOW_COPY_AND_ASSIGN(MediaCodecAudioDecoder); | 94 DISALLOW_COPY_AND_ASSIGN(MediaCodecAudioDecoder); |
91 }; | 95 }; |
92 | 96 |
93 } // namespace media | 97 } // namespace media |
94 | 98 |
95 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ | 99 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ |
OLD | NEW |