Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: media/base/android/media_codec_audio_decoder.h

Issue 1128383003: Implementation of MediaCodecPlayer stage 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed stop procedure, fixed compilation Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_AUDIO_DECODER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_AUDIO_DECODER_H_
7
8 #include "media/base/android/media_codec_decoder.h"
9
10 namespace media {
11 class AudioTimestampHelper;
12 }
13
14 namespace media {
15
16 class MediaCodecAudioDecoder : public MediaCodecDecoder {
17 public:
18 MediaCodecAudioDecoder(
19 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner,
20 const scoped_refptr<base::SingleThreadTaskRunner>& ui_runner,
21 const base::Closure& request_data_cb,
22 const base::Closure& starvation_cb,
23 const base::Closure& stop_done_cb,
24 const base::Closure& error_cb,
25 const SetTimeCallback& update_current_time_cb);
26 ~MediaCodecAudioDecoder() override;
27
28 const char * class_name() const override { return "AudioDecoder"; }
29
30 bool HasStream() const override;
31 void Flush() override;
32
33 // Sets the volume of the audio output.
34 void SetVolume(double volume);
35
36 // Sets the base timestamp for |audio_timestamp_helper_|.
37 void SetBaseTimestamp(base::TimeDelta base_timestamp);
38
39 protected:
40 bool IsCodecReconfigureNeeded(const DemuxerConfigs& curr,
41 const DemuxerConfigs& next) const override;
42 ConfigStatus ConfigureInternal() override;
43 void Render(int buffer_index, size_t size, bool render_output,
44 base::TimeDelta pts, bool eos_encountered) override;
45
46 private:
47 void SetVolumeInternal();
48 void ResetTimestampHelper();
49
50
51 // Requested volume
52 double volume_;
53
54 // Number of bytes per audio frame. Depends on the output format
55 // and the number of channels.
56 int bytes_per_frame_;
57
58 // Frame count to sync with audio codec output
59 int64 frame_count_;
60
61 // Base timestamp for the |audio_timestamp_helper_|.
62 base::TimeDelta base_timestamp_;
63
64 // Object to calculate the current audio timestamp for A/V sync.
65 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_;
66
67 DISALLOW_COPY_AND_ASSIGN(MediaCodecAudioDecoder);
68 };
69
70 } // namespace media
71
72 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698