Chromium Code Reviews| 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 <vector> | |
|
wolenetz
2015/08/20 20:37:36
nit: insert blank line between <> and "" includes.
Tima Vaisburd
2015/08/20 22:36:36
Just removed this include, it is not needed.
| |
| 8 #include "media/base/android/media_codec_decoder.h" | 9 #include "media/base/android/media_codec_decoder.h" |
| 9 | 10 |
| 10 namespace media { | 11 namespace media { |
| 11 | 12 |
| 12 class AudioTimestampHelper; | 13 class AudioTimestampHelper; |
| 13 | 14 |
| 14 // Audio decoder for MediaCodecPlayer | 15 // Audio decoder for MediaCodecPlayer |
| 15 class MediaCodecAudioDecoder : public MediaCodecDecoder { | 16 class MediaCodecAudioDecoder : public MediaCodecDecoder { |
| 16 public: | 17 public: |
| 17 // For parameters see media_codec_decoder.h | 18 // For parameters see media_codec_decoder.h |
| 18 // update_current_time_cb: callback that reports current playback time. | 19 // update_current_time_cb: callback that reports current playback time. |
| 19 // Called for each rendered frame. | 20 // Called for each rendered frame. |
| 20 MediaCodecAudioDecoder( | 21 MediaCodecAudioDecoder( |
| 21 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, | 22 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, |
| 22 const base::Closure& request_data_cb, | 23 const base::Closure& request_data_cb, |
| 23 const base::Closure& starvation_cb, | 24 const base::Closure& starvation_cb, |
| 24 const base::Closure& stop_done_cb, | 25 const base::Closure& stop_done_cb, |
| 25 const base::Closure& error_cb, | 26 const base::Closure& error_cb, |
| 26 const SetTimeCallback& update_current_time_cb); | 27 const SetTimeCallback& update_current_time_cb); |
| 27 ~MediaCodecAudioDecoder() override; | 28 ~MediaCodecAudioDecoder() override; |
| 28 | 29 |
| 29 const char* class_name() const override; | 30 const char* class_name() const override; |
| 30 | 31 |
| 31 bool HasStream() const override; | 32 bool HasStream() const override; |
| 32 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; | 33 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; |
| 33 void Flush() override; | 34 void Flush() override; |
| 35 void ReleaseMediaCodec() override; | |
| 34 | 36 |
| 35 // Sets the volume of the audio output. | 37 // Sets the volume of the audio output. |
| 36 void SetVolume(double volume); | 38 void SetVolume(double volume); |
| 37 | 39 |
| 38 // Sets the base timestamp for |audio_timestamp_helper_|. | 40 // Sets the base timestamp for |audio_timestamp_helper_|. |
| 39 void SetBaseTimestamp(base::TimeDelta base_timestamp); | 41 void SetBaseTimestamp(base::TimeDelta base_timestamp); |
| 40 | 42 |
| 41 protected: | 43 protected: |
| 42 bool IsCodecReconfigureNeeded(const DemuxerConfigs& curr, | 44 bool IsCodecReconfigureNeeded(const DemuxerConfigs& curr, |
| 43 const DemuxerConfigs& next) const override; | 45 const DemuxerConfigs& next) const override; |
| 44 ConfigStatus ConfigureInternal() override; | 46 ConfigStatus ConfigureInternal() override; |
| 45 void OnOutputFormatChanged() override; | 47 void OnOutputFormatChanged() override; |
| 46 void Render(int buffer_index, | 48 void Render(int buffer_index, |
| 47 size_t size, | 49 size_t size, |
| 48 bool render_output, | 50 RenderMode render_mode, |
| 49 base::TimeDelta pts, | 51 base::TimeDelta pts, |
| 50 bool eos_encountered) override; | 52 bool eos_encountered) override; |
| 51 | 53 |
| 52 private: | 54 private: |
| 53 // A helper method to set the volume. | 55 // A helper method to set the volume. |
| 54 void SetVolumeInternal(); | 56 void SetVolumeInternal(); |
| 55 | 57 |
| 56 // Recreates |audio_timestamp_helper_|, called when sampling rate is changed. | 58 // Recreates |audio_timestamp_helper_|, called when sampling rate is changed. |
| 57 void ResetTimestampHelper(); | 59 void ResetTimestampHelper(); |
| 58 | 60 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 82 | 84 |
| 83 // Reports current playback time to the callee. | 85 // Reports current playback time to the callee. |
| 84 SetTimeCallback update_current_time_cb_; | 86 SetTimeCallback update_current_time_cb_; |
| 85 | 87 |
| 86 DISALLOW_COPY_AND_ASSIGN(MediaCodecAudioDecoder); | 88 DISALLOW_COPY_AND_ASSIGN(MediaCodecAudioDecoder); |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 } // namespace media | 91 } // namespace media |
| 90 | 92 |
| 91 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ | 93 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ |
| OLD | NEW |