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

Unified Diff: content/renderer/media/media_stream_audio_source.h

Issue 2416123002: Stop media stream source when audio capture error occurs. (Closed)
Patch Set: Rebase. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_audio_source.h
diff --git a/content/renderer/media/media_stream_audio_source.h b/content/renderer/media/media_stream_audio_source.h
index 235227189090955df93ef26a83f749be91ed1bc3..392dac046bb492b87ce6b1219249de29f1da9011 100644
--- a/content/renderer/media/media_stream_audio_source.h
+++ b/content/renderer/media/media_stream_audio_source.h
@@ -17,6 +17,10 @@
#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
+namespace base {
+class SingleThreadTaskRunner;
+}
+
namespace content {
class MediaStreamAudioTrack;
@@ -123,6 +127,11 @@ class CONTENT_EXPORT MediaStreamAudioSource
void DeliverDataToTracks(const media::AudioBus& audio_bus,
base::TimeTicks reference_time);
+ // Called by subclasses when capture error occurs.
+ // Note: This can be called on any thread, and will post a task to the main
+ // thread to stop the source soon.
+ void StopSourceOnError(const std::string& why);
+
private:
// MediaStreamSource override.
void DoStopSource() final;
@@ -136,16 +145,17 @@ class CONTENT_EXPORT MediaStreamAudioSource
// remote (e.g., streamed-in from a server).
const bool is_local_source_;
- // In debug builds, check that all methods that could cause object graph
- // or data flow changes are being called on the main thread.
- base::ThreadChecker thread_checker_;
-
// Set to true once this source has been permanently stopped.
bool is_stopped_;
// Manages tracks connected to this source and the audio format and data flow.
MediaStreamAudioDeliverer<MediaStreamAudioTrack> deliverer_;
+ // The task runner for main thread. Also used to check that all methods that
+ // could cause object graph or data flow changes are being called on the main
+ // thread.
+ const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+
// Provides weak pointers so that MediaStreamAudioTracks won't call
// StopAudioDeliveryTo() if this instance dies first.
base::WeakPtrFactory<MediaStreamAudioSource> weak_factory_;
« no previous file with comments | « content/renderer/media/local_media_stream_audio_source.cc ('k') | content/renderer/media/media_stream_audio_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698