OLD | NEW |
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 Loading... |
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::IsSurfaceInUse() const { | 204 bool MediaSourcePlayer::IsSurfaceInUse() const { |
204 return video_decoder_job_ && video_decoder_job_->is_decoding(); | 205 return video_decoder_job_ && video_decoder_job_->is_decoding(); |
205 } | 206 } |
206 | 207 |
(...skipping 16 matching lines...) Expand all Loading... |
223 void MediaSourcePlayer::StartInternal() { | 224 void MediaSourcePlayer::StartInternal() { |
224 DVLOG(1) << __FUNCTION__; | 225 DVLOG(1) << __FUNCTION__; |
225 // If there are pending events, wait for them finish. | 226 // If there are pending events, wait for them finish. |
226 if (pending_event_ != NO_EVENT_PENDING) | 227 if (pending_event_ != NO_EVENT_PENDING) |
227 return; | 228 return; |
228 | 229 |
229 // When we start, we'll have new demuxed data coming in. This new data could | 230 // When we start, we'll have new demuxed data coming in. This new data could |
230 // be clear (not encrypted) or encrypted with different keys. So | 231 // be clear (not encrypted) or encrypted with different keys. So |
231 // |is_waiting_for_key_| condition may not be true anymore. | 232 // |is_waiting_for_key_| condition may not be true anymore. |
232 is_waiting_for_key_ = false; | 233 is_waiting_for_key_ = false; |
| 234 AttachListener(NULL); |
233 | 235 |
234 SetPendingEvent(PREFETCH_REQUEST_EVENT_PENDING); | 236 SetPendingEvent(PREFETCH_REQUEST_EVENT_PENDING); |
235 ProcessPendingEvents(); | 237 ProcessPendingEvents(); |
236 } | 238 } |
237 | 239 |
238 void MediaSourcePlayer::OnDemuxerConfigsAvailable( | 240 void MediaSourcePlayer::OnDemuxerConfigsAvailable( |
239 const DemuxerConfigs& configs) { | 241 const DemuxerConfigs& configs) { |
240 DVLOG(1) << __FUNCTION__; | 242 DVLOG(1) << __FUNCTION__; |
241 DCHECK(!HasAudio() && !HasVideo()); | 243 DCHECK(!HasAudio() && !HasVideo()); |
242 duration_ = configs.duration; | 244 duration_ = configs.duration; |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 // support setMediaKeys(0) (see http://crbug.com/330324), or when we release | 775 // support setMediaKeys(0) (see http://crbug.com/330324), or when we release |
774 // MediaDrm when the video is paused, or when the device goes to sleep (see | 776 // MediaDrm when the video is paused, or when the device goes to sleep (see |
775 // http://crbug.com/272421). | 777 // http://crbug.com/272421). |
776 audio_decoder_job_->SetDrmBridge(NULL); | 778 audio_decoder_job_->SetDrmBridge(NULL); |
777 video_decoder_job_->SetDrmBridge(NULL); | 779 video_decoder_job_->SetDrmBridge(NULL); |
778 cdm_registration_id_ = 0; | 780 cdm_registration_id_ = 0; |
779 drm_bridge_ = NULL; | 781 drm_bridge_ = NULL; |
780 } | 782 } |
781 | 783 |
782 } // namespace media | 784 } // namespace media |
OLD | NEW |