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

Unified Diff: media/base/android/media_source_player.h

Issue 1008093002: Determine the audible state in MediaSourcePlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit test Created 5 years, 9 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: media/base/android/media_source_player.h
diff --git a/media/base/android/media_source_player.h b/media/base/android/media_source_player.h
index 874e61add84c22ed95a1da86f47843da73991716..6db908ac3d9b9cb1048a27be9745e52bcfc3a076 100644
--- a/media/base/android/media_source_player.h
+++ b/media/base/android/media_source_player.h
@@ -69,7 +69,10 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override;
void OnDemuxerDurationChanged(base::TimeDelta duration) override;
- private:
+ // Sets the idle period after which the audible state is considered gone.
+ void SetAudibleStateIdlePeriod(base::TimeDelta duration);
+
+private:
friend class MediaSourcePlayerTest;
// Update the current timestamp.
@@ -168,6 +171,9 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
// Called when the CDM is detached.
void OnCdmUnset();
+ // Set the status that the audio is currently playing
+ void UpdateAudibleStatus();
+
// Test-only method to setup hook for the completion of the next decode cycle.
// This callback state is cleared when it is next run.
// Prevent usage creep by only calling this from the
@@ -245,6 +251,16 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
// elapses.
base::CancelableClosure decoder_starvation_callback_;
+ // A cancelable task that is reposted every time we enqueue an audio frame.
+ // It arrived when the stream of frames interrupted, telling there is
+ // no audible audio any more.
+ base::CancelableClosure audible_audio_stopped_callback_;
+
+ // The delay for audible_audio_stopped_callback_.
+ // If a new audio frame arrives after this delay,
+ // we will report non-audible state.
+ base::TimeDelta audible_state_idle_period_;
+
MediaDrmBridge* drm_bridge_;
int cdm_registration_id_;

Powered by Google App Engine
This is Rietveld 408576698