OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "content/public/browser/media_request_state.h" | 9 #include "content/public/browser/media_request_state.h" |
10 #include "content/public/common/media_stream_request.h" | 10 #include "content/public/common/media_stream_request.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 int render_frame_id, | 27 int render_frame_id, |
28 int page_request_id, | 28 int page_request_id, |
29 const GURL& security_origin, | 29 const GURL& security_origin, |
30 MediaStreamType stream_type, | 30 MediaStreamType stream_type, |
31 MediaRequestState state) = 0; | 31 MediaRequestState state) = 0; |
32 | 32 |
33 // Called when an audio stream is being created. | 33 // Called when an audio stream is being created. |
34 virtual void OnCreatingAudioStream(int render_process_id, | 34 virtual void OnCreatingAudioStream(int render_process_id, |
35 int render_frame_id) = 0; | 35 int render_frame_id) = 0; |
36 | 36 |
37 // Called when an audio stream transitions into a playing state. | |
38 // |power_read_callback| is a thread-safe callback, provided for polling the | |
39 // current audio signal power level, and any copies/references to it must be | |
40 // destroyed when OnAudioStreamStopped() is called. | |
41 // | |
42 // The callback returns the current power level (in dBFS units) and the clip | |
43 // status (true if any part of the audio signal has clipped since the last | |
44 // callback run). See media/audio/audio_power_monitor.h for more info. | |
45 typedef base::Callback<std::pair<float, bool>()> ReadPowerAndClipCallback; | |
46 virtual void OnAudioStreamPlaying( | |
47 int render_process_id, | |
48 int render_frame_id, | |
49 int stream_id, | |
50 const ReadPowerAndClipCallback& power_read_callback) = 0; | |
51 | |
52 // Called when an audio stream has stopped. | |
53 virtual void OnAudioStreamStopped( | |
54 int render_process_id, | |
55 int render_frame_id, | |
56 int stream_id) = 0; | |
57 | |
58 protected: | 37 protected: |
59 virtual ~MediaObserver() {} | 38 virtual ~MediaObserver() {} |
60 }; | 39 }; |
61 | 40 |
62 } // namespace content | 41 } // namespace content |
63 | 42 |
64 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_ | 43 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_OBSERVER_H_ |
OLD | NEW |