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

Side by Side Diff: media/base/android/media_source_player.cc

Issue 643353002: Listen to the audio focus event for MSE/EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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 unified diff | Download patch
« no previous file with comments | « media/base/android/media_player_listener.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "media/base/android/media_source_player.h" 5 #include "media/base/android/media_source_player.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 void MediaSourcePlayer::Release() { 187 void MediaSourcePlayer::Release() {
188 DVLOG(1) << __FUNCTION__; 188 DVLOG(1) << __FUNCTION__;
189 189
190 audio_decoder_job_->ReleaseDecoderResources(); 190 audio_decoder_job_->ReleaseDecoderResources();
191 video_decoder_job_->ReleaseDecoderResources(); 191 video_decoder_job_->ReleaseDecoderResources();
192 192
193 // Prevent player restart, including job re-creation attempts. 193 // Prevent player restart, including job re-creation attempts.
194 playing_ = false; 194 playing_ = false;
195 195
196 decoder_starvation_callback_.Cancel(); 196 decoder_starvation_callback_.Cancel();
197 DetachListener();
197 } 198 }
198 199
199 void MediaSourcePlayer::SetVolume(double volume) { 200 void MediaSourcePlayer::SetVolume(double volume) {
200 audio_decoder_job_->SetVolume(volume); 201 audio_decoder_job_->SetVolume(volume);
201 } 202 }
202 203
203 bool MediaSourcePlayer::CanPause() { 204 bool MediaSourcePlayer::CanPause() {
204 return Seekable(); 205 return Seekable();
205 } 206 }
206 207
(...skipping 12 matching lines...) Expand all
219 void MediaSourcePlayer::StartInternal() { 220 void MediaSourcePlayer::StartInternal() {
220 DVLOG(1) << __FUNCTION__; 221 DVLOG(1) << __FUNCTION__;
221 // If there are pending events, wait for them finish. 222 // If there are pending events, wait for them finish.
222 if (pending_event_ != NO_EVENT_PENDING) 223 if (pending_event_ != NO_EVENT_PENDING)
223 return; 224 return;
224 225
225 // When we start, we'll have new demuxed data coming in. This new data could 226 // When we start, we'll have new demuxed data coming in. This new data could
226 // be clear (not encrypted) or encrypted with different keys. So 227 // be clear (not encrypted) or encrypted with different keys. So
227 // |is_waiting_for_key_| condition may not be true anymore. 228 // |is_waiting_for_key_| condition may not be true anymore.
228 is_waiting_for_key_ = false; 229 is_waiting_for_key_ = false;
230 AttachListener(NULL);
229 231
230 SetPendingEvent(PREFETCH_REQUEST_EVENT_PENDING); 232 SetPendingEvent(PREFETCH_REQUEST_EVENT_PENDING);
231 ProcessPendingEvents(); 233 ProcessPendingEvents();
232 } 234 }
233 235
234 void MediaSourcePlayer::OnDemuxerConfigsAvailable( 236 void MediaSourcePlayer::OnDemuxerConfigsAvailable(
235 const DemuxerConfigs& configs) { 237 const DemuxerConfigs& configs) {
236 DVLOG(1) << __FUNCTION__; 238 DVLOG(1) << __FUNCTION__;
237 DCHECK(!HasAudio() && !HasVideo()); 239 DCHECK(!HasAudio() && !HasVideo());
238 duration_ = configs.duration; 240 duration_ = configs.duration;
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 // support setMediaKeys(0) (see http://crbug.com/330324), or when we release 771 // support setMediaKeys(0) (see http://crbug.com/330324), or when we release
770 // MediaDrm when the video is paused, or when the device goes to sleep (see 772 // MediaDrm when the video is paused, or when the device goes to sleep (see
771 // http://crbug.com/272421). 773 // http://crbug.com/272421).
772 audio_decoder_job_->SetDrmBridge(NULL); 774 audio_decoder_job_->SetDrmBridge(NULL);
773 video_decoder_job_->SetDrmBridge(NULL); 775 video_decoder_job_->SetDrmBridge(NULL);
774 cdm_registration_id_ = 0; 776 cdm_registration_id_ = 0;
775 drm_bridge_ = NULL; 777 drm_bridge_ = NULL;
776 } 778 }
777 779
778 } // namespace media 780 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_player_listener.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698