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

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

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « chromecast/media/BUILD.gn ('k') | chromecast/media/audio/cast_audio_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MANAGER_H_ 5 #ifndef CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_
6 #define CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_ 6 #define CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "media/audio/audio_manager_base.h" 9 #include "media/audio/audio_manager_base.h"
10 10
11 namespace chromecast { 11 namespace chromecast {
12 12
13 namespace media { 13 namespace media {
14 14
15 class CastAudioMixer; 15 class CastAudioMixer;
16 class MediaPipelineBackend; 16 class MediaPipelineBackend;
17 class MediaPipelineBackendManager; 17 class MediaPipelineBackendManager;
18 struct MediaPipelineDeviceParams; 18 struct MediaPipelineDeviceParams;
19 19
20 class CastAudioManager : public ::media::AudioManagerBase { 20 class CastAudioManager : public ::media::AudioManagerBase {
21 public: 21 public:
22 CastAudioManager( 22 CastAudioManager(std::unique_ptr<::media::AudioThread> audio_thread,
23 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 23 ::media::AudioLogFactory* audio_log_factory,
24 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 24 MediaPipelineBackendManager* backend_manager);
25 ::media::AudioLogFactory* audio_log_factory, 25 CastAudioManager(std::unique_ptr<::media::AudioThread> audio_thread,
26 MediaPipelineBackendManager* backend_manager); 26 ::media::AudioLogFactory* audio_log_factory,
27 CastAudioManager( 27 MediaPipelineBackendManager* backend_manager,
28 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 28 CastAudioMixer* audio_mixer);
29 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 29 ~CastAudioManager() override;
30 ::media::AudioLogFactory* audio_log_factory,
31 MediaPipelineBackendManager* backend_manager,
32 CastAudioMixer* audio_mixer);
33 30
34 // AudioManager implementation. 31 // AudioManager implementation.
35 bool HasAudioOutputDevices() override; 32 bool HasAudioOutputDevices() override;
36 bool HasAudioInputDevices() override; 33 bool HasAudioInputDevices() override;
37 void ShowAudioInputSettings() override; 34 void ShowAudioInputSettings() override;
38 void GetAudioInputDeviceNames( 35 void GetAudioInputDeviceNames(
39 ::media::AudioDeviceNames* device_names) override; 36 ::media::AudioDeviceNames* device_names) override;
40 ::media::AudioParameters GetInputStreamParameters( 37 ::media::AudioParameters GetInputStreamParameters(
41 const std::string& device_id) override; 38 const std::string& device_id) override;
42 const char* GetName() override; 39 const char* GetName() override;
43 40
44 // AudioManagerBase implementation 41 // AudioManagerBase implementation
45 void ReleaseOutputStream(::media::AudioOutputStream* stream) override; 42 void ReleaseOutputStream(::media::AudioOutputStream* stream) override;
46 43
47 // This must be called on audio thread. 44 // This must be called on audio thread.
48 virtual std::unique_ptr<MediaPipelineBackend> CreateMediaPipelineBackend( 45 virtual std::unique_ptr<MediaPipelineBackend> CreateMediaPipelineBackend(
49 const MediaPipelineDeviceParams& params); 46 const MediaPipelineDeviceParams& params);
50 47
51 protected:
52 ~CastAudioManager() override;
53
54 private: 48 private:
55 // AudioManagerBase implementation. 49 // AudioManagerBase implementation.
56 ::media::AudioOutputStream* MakeLinearOutputStream( 50 ::media::AudioOutputStream* MakeLinearOutputStream(
57 const ::media::AudioParameters& params, 51 const ::media::AudioParameters& params,
58 const ::media::AudioManager::LogCallback& log_callback) override; 52 const ::media::AudioManager::LogCallback& log_callback) override;
59 ::media::AudioOutputStream* MakeLowLatencyOutputStream( 53 ::media::AudioOutputStream* MakeLowLatencyOutputStream(
60 const ::media::AudioParameters& params, 54 const ::media::AudioParameters& params,
61 const std::string& device_id, 55 const std::string& device_id,
62 const ::media::AudioManager::LogCallback& log_callback) override; 56 const ::media::AudioManager::LogCallback& log_callback) override;
63 ::media::AudioInputStream* MakeLinearInputStream( 57 ::media::AudioInputStream* MakeLinearInputStream(
(...skipping 16 matching lines...) Expand all
80 std::unique_ptr<::media::AudioOutputStream> mixer_output_stream_; 74 std::unique_ptr<::media::AudioOutputStream> mixer_output_stream_;
81 std::unique_ptr<CastAudioMixer> mixer_; 75 std::unique_ptr<CastAudioMixer> mixer_;
82 76
83 DISALLOW_COPY_AND_ASSIGN(CastAudioManager); 77 DISALLOW_COPY_AND_ASSIGN(CastAudioManager);
84 }; 78 };
85 79
86 } // namespace media 80 } // namespace media
87 } // namespace chromecast 81 } // namespace chromecast
88 82
89 #endif // CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_ 83 #endif // CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_
OLDNEW
« no previous file with comments | « chromecast/media/BUILD.gn ('k') | chromecast/media/audio/cast_audio_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698