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 #ifndef MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ | 5 #ifndef MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ |
6 #define MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ | 6 #define MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "media/base/android/media_decoder_job.h" | 12 #include "media/base/android/media_decoder_job.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 class AudioCodecBridge; | 16 class AudioCodecBridge; |
17 class AudioTimestampHelper; | 17 class AudioTimestampHelper; |
18 | 18 |
19 // Class for managing audio decoding jobs. | 19 // Class for managing audio decoding jobs. |
20 class AudioDecoderJob : public MediaDecoderJob { | 20 class AudioDecoderJob : public MediaDecoderJob { |
21 public: | 21 public: |
22 // Creates a new AudioDecoderJob instance for decoding audio. | 22 // Creates a new AudioDecoderJob instance for decoding audio. |
23 // |request_data_cb| - Callback used to request more data for the decoder. | 23 // |request_data_cb| - Callback used to request more data for the decoder. |
24 // |on_demuxer_config_changed_cb| - Callback used to inform the caller that | 24 // |on_demuxer_config_changed_cb| - Callback used to inform the caller that |
25 // demuxer config has changed. | 25 // demuxer config has changed. |
26 AudioDecoderJob(const base::Closure& request_data_cb, | 26 AudioDecoderJob(const base::Closure& request_data_cb, |
27 const base::Closure& on_demuxer_config_changed_cb); | 27 const base::Closure& on_demuxer_config_changed_cb, |
| 28 FrameStatistics* frame_statistics); |
28 ~AudioDecoderJob() override; | 29 ~AudioDecoderJob() override; |
29 | 30 |
30 // MediaDecoderJob implementation. | 31 // MediaDecoderJob implementation. |
31 bool HasStream() const override; | 32 bool HasStream() const override; |
32 void Flush() override; | 33 void Flush() override; |
33 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; | 34 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; |
34 | 35 |
35 // Sets the volume of the audio output. | 36 // Sets the volume of the audio output. |
36 void SetVolume(double volume); | 37 void SetVolume(double volume); |
37 | 38 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 73 |
73 // Frame count to sync with audio codec output | 74 // Frame count to sync with audio codec output |
74 int64 frame_count_; | 75 int64 frame_count_; |
75 | 76 |
76 // Base timestamp for the |audio_timestamp_helper_|. | 77 // Base timestamp for the |audio_timestamp_helper_|. |
77 base::TimeDelta base_timestamp_; | 78 base::TimeDelta base_timestamp_; |
78 | 79 |
79 // Object to calculate the current audio timestamp for A/V sync. | 80 // Object to calculate the current audio timestamp for A/V sync. |
80 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; | 81 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; |
81 | 82 |
| 83 // The time limit for the next frame to avoid underrun. |
| 84 base::TimeTicks next_frame_time_limit_; |
| 85 |
82 DISALLOW_COPY_AND_ASSIGN(AudioDecoderJob); | 86 DISALLOW_COPY_AND_ASSIGN(AudioDecoderJob); |
83 }; | 87 }; |
84 | 88 |
85 } // namespace media | 89 } // namespace media |
86 | 90 |
87 #endif // MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ | 91 #endif // MEDIA_BASE_ANDROID_AUDIO_DECODER_JOB_H_ |
OLD | NEW |