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

Side by Side Diff: media/audio/android/audio_track_output_stream.h

Issue 2466463005: Support (E)AC3 passthrough
Patch Set: Add unit tests Created 3 years, 6 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 2017 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_AUDIO_ANDROID_AUDIO_TRACK_OUTPUT_STREAM_H_
6 #define MEDIA_AUDIO_ANDROID_AUDIO_TRACK_OUTPUT_STREAM_H_
7
8 #include <memory>
9
10 #include "base/android/jni_android.h"
11 #include "base/time/tick_clock.h"
12 #include "media/audio/android/muteable_audio_output_stream.h"
13 #include "media/base/audio_parameters.h"
14
15 namespace media {
16
17 class AudioManagerBase;
18
19 // A MuteableAudioOutputStream implementation based on the Android AudioTrack
20 // API.
21 class MEDIA_EXPORT AudioTrackOutputStream : public MuteableAudioOutputStream {
22 public:
23 AudioTrackOutputStream(AudioManagerBase* manager,
24 const AudioParameters& params);
25 ~AudioTrackOutputStream() override;
26
27 // AudioOutputStream implementation.
28 bool Open() override;
29 void Start(AudioSourceCallback* callback) override;
30 void Stop() override;
31 void SetVolume(double volume) override;
32 void GetVolume(double* volume) override;
33 void Close() override;
34
35 // MuteableAudioOutputStream implementation.
36 void SetMute(bool muted) override;
37
38 // JNI registry.
39 static bool RegisterAudioTrackOutputStream(JNIEnv* env);
40
41 // AudioOutputStream::SourceCallback implementation methods called from Java.
42 int OnMoreData(JNIEnv* env, jobject obj, jobject audio_data, int delay);
43 void OnError(JNIEnv* env, jobject obj);
44
45 private:
46 const AudioParameters params_;
47
48 AudioManagerBase* audio_manager_;
49 AudioSourceCallback* callback_;
50 std::unique_ptr<AudioBus> audio_bus_;
51 bool muted_;
52 double volume_;
53 int total_read_frames_;
chcunningham 2017/06/14 20:27:21 At sample rate of 44.1 you can only do about 13 ho
AndyWu 2017/08/02 01:43:39 Done.
54
55 std::unique_ptr<base::TickClock> tick_clock_;
56
57 // Java AudioTrackOutputStream instance.
58 base::android::ScopedJavaGlobalRef<jobject> j_audio_output_stream_;
59
60 DISALLOW_COPY_AND_ASSIGN(AudioTrackOutputStream);
61 };
62
63 } // namespace media
64
65 #endif // MEDIA_AUDIO_ANDROID_AUDIO_TRACK_OUTPUT_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698