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

Side by Side Diff: chromecast/media/audio/cast_audio_output_stream.h

Issue 2879703003: [chromecast] Moves CastAudioOutputStream::Backend to CMA thread. (Closed)
Patch Set: addressed comments 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
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 CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_ 5 #ifndef CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_
6 #define CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_ 6 #define CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h"
13 #include "media/audio/audio_io.h" 11 #include "media/audio/audio_io.h"
14 #include "media/base/audio_parameters.h" 12 #include "media/base/audio_parameters.h"
15 #include "media/base/audio_timestamp_helper.h"
16 13
17 namespace chromecast { 14 namespace chromecast {
18 namespace media { 15 namespace media {
19 16
20 class CastAudioManager; 17 class CastAudioManager;
21 class DecoderBufferBase;
22 18
23 class CastAudioOutputStream : public ::media::AudioOutputStream { 19 class CastAudioOutputStream : public ::media::AudioOutputStream {
24 public: 20 public:
25 CastAudioOutputStream(const ::media::AudioParameters& audio_params, 21 CastAudioOutputStream(const ::media::AudioParameters& audio_params,
26 CastAudioManager* audio_manager); 22 CastAudioManager* audio_manager);
27 ~CastAudioOutputStream() override; 23 ~CastAudioOutputStream() override;
28 24
29 // ::media::AudioOutputStream implementation. 25 // ::media::AudioOutputStream implementation.
30 bool Open() override; 26 bool Open() override;
31 void Close() override; 27 void Close() override;
32 void Start(AudioSourceCallback* source_callback) override; 28 void Start(AudioSourceCallback* source_callback) override;
33 void Stop() override; 29 void Stop() override;
34 void SetVolume(double volume) override; 30 void SetVolume(double volume) override;
35 void GetVolume(double* volume) override; 31 void GetVolume(double* volume) override;
36 32
37 private: 33 private:
38 class Backend; 34 class Backend;
39 35
40 void PushBuffer();
41 void OnPushBufferComplete(bool success);
42
43 const ::media::AudioParameters audio_params_; 36 const ::media::AudioParameters audio_params_;
44 CastAudioManager* const audio_manager_; 37 CastAudioManager* const audio_manager_;
38 double volume_;
45 39
46 double volume_; 40 // Only valid when the stream is open.
47 AudioSourceCallback* source_callback_;
48 std::unique_ptr<::media::AudioBus> audio_bus_;
49 scoped_refptr<media::DecoderBufferBase> decoder_buffer_;
50 ::media::AudioTimestampHelper timestamp_helper_;
51 std::unique_ptr<Backend> backend_; 41 std::unique_ptr<Backend> backend_;
52 const base::TimeDelta buffer_duration_;
53 bool push_in_progress_;
54 base::TimeTicks next_push_time_;
55
56 base::WeakPtrFactory<CastAudioOutputStream> weak_factory_;
57 42
58 DISALLOW_COPY_AND_ASSIGN(CastAudioOutputStream); 43 DISALLOW_COPY_AND_ASSIGN(CastAudioOutputStream);
59 }; 44 };
60 45
61 } // namespace media 46 } // namespace media
62 } // namespace chromecast 47 } // namespace chromecast
63 48
64 #endif // CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_ 49 #endif // CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_
OLDNEW
« no previous file with comments | « chromecast/media/audio/cast_audio_mixer_unittest.cc ('k') | chromecast/media/audio/cast_audio_output_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698