| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_codec_player.h" | 5 #include "media/base/android/media_codec_player.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // watching the demuxer, which is destroyed as one of the member variables. | 95 // watching the demuxer, which is destroyed as one of the member variables. |
| 96 // Release the codecs here, before any member variable is destroyed to make | 96 // Release the codecs here, before any member variable is destroyed to make |
| 97 // the unit tests happy. | 97 // the unit tests happy. |
| 98 | 98 |
| 99 if (video_decoder_) | 99 if (video_decoder_) |
| 100 video_decoder_->ReleaseDecoderResources(); | 100 video_decoder_->ReleaseDecoderResources(); |
| 101 if (audio_decoder_) | 101 if (audio_decoder_) |
| 102 audio_decoder_->ReleaseDecoderResources(); | 102 audio_decoder_->ReleaseDecoderResources(); |
| 103 | 103 |
| 104 if (cdm_) { | 104 if (cdm_) { |
| 105 // Cancel previously registered callback (if any). |
| 106 static_cast<MediaDrmBridge*>(cdm_.get()) |
| 107 ->SetMediaCryptoReadyCB(MediaDrmBridge::MediaCryptoReadyCB()); |
| 108 |
| 105 DCHECK(cdm_registration_id_); | 109 DCHECK(cdm_registration_id_); |
| 106 static_cast<MediaDrmBridge*>(cdm_.get()) | 110 static_cast<MediaDrmBridge*>(cdm_.get()) |
| 107 ->UnregisterPlayer(cdm_registration_id_); | 111 ->UnregisterPlayer(cdm_registration_id_); |
| 108 } | 112 } |
| 109 } | 113 } |
| 110 | 114 |
| 111 void MediaCodecPlayer::Initialize() { | 115 void MediaCodecPlayer::Initialize() { |
| 112 DVLOG(1) << __FUNCTION__; | 116 DVLOG(1) << __FUNCTION__; |
| 113 DCHECK(GetMediaTaskRunner()->BelongsToCurrentThread()); | 117 DCHECK(GetMediaTaskRunner()->BelongsToCurrentThread()); |
| 114 | 118 |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 RETURN_STRING(kStateWaitingForMediaCrypto); | 1419 RETURN_STRING(kStateWaitingForMediaCrypto); |
| 1416 RETURN_STRING(kStateWaitingForSeek); | 1420 RETURN_STRING(kStateWaitingForSeek); |
| 1417 RETURN_STRING(kStateError); | 1421 RETURN_STRING(kStateError); |
| 1418 } | 1422 } |
| 1419 return nullptr; // crash early | 1423 return nullptr; // crash early |
| 1420 } | 1424 } |
| 1421 | 1425 |
| 1422 #undef RETURN_STRING | 1426 #undef RETURN_STRING |
| 1423 | 1427 |
| 1424 } // namespace media | 1428 } // namespace media |
| OLD | NEW |