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

Side by Side Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 2426813002: EME: Close existing sessions on CDM failure (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/pepper/content_decryptor_delegate.h" 5 #include "content/renderer/pepper/content_decryptor_delegate.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 736 }
737 737
738 void ContentDecryptorDelegate::OnPromiseResolved(uint32_t promise_id) { 738 void ContentDecryptorDelegate::OnPromiseResolved(uint32_t promise_id) {
739 cdm_promise_adapter_.ResolvePromise(promise_id); 739 cdm_promise_adapter_.ResolvePromise(promise_id);
740 } 740 }
741 741
742 void ContentDecryptorDelegate::OnPromiseResolvedWithSession(uint32_t promise_id, 742 void ContentDecryptorDelegate::OnPromiseResolvedWithSession(uint32_t promise_id,
743 PP_Var session_id) { 743 PP_Var session_id) {
744 StringVar* session_id_string = StringVar::FromPPVar(session_id); 744 StringVar* session_id_string = StringVar::FromPPVar(session_id);
745 DCHECK(session_id_string); 745 DCHECK(session_id_string);
746 cdm_session_tracker_.AddSession(session_id_string->value());
746 cdm_promise_adapter_.ResolvePromise(promise_id, session_id_string->value()); 747 cdm_promise_adapter_.ResolvePromise(promise_id, session_id_string->value());
747 } 748 }
748 749
749 void ContentDecryptorDelegate::OnPromiseRejected( 750 void ContentDecryptorDelegate::OnPromiseRejected(
750 uint32_t promise_id, 751 uint32_t promise_id,
751 PP_CdmExceptionCode exception_code, 752 PP_CdmExceptionCode exception_code,
752 uint32_t system_code, 753 uint32_t system_code,
753 PP_Var error_description) { 754 PP_Var error_description) {
754 ReportSystemCodeUMA(key_system_, system_code); 755 ReportSystemCodeUMA(key_system_, system_code);
755 756
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 return; 816 return;
816 817
817 StringVar* session_id_string = StringVar::FromPPVar(session_id); 818 StringVar* session_id_string = StringVar::FromPPVar(session_id);
818 DCHECK(session_id_string); 819 DCHECK(session_id_string);
819 820
820 session_expiration_update_cb_.Run(session_id_string->value(), 821 session_expiration_update_cb_.Run(session_id_string->value(),
821 ppapi::PPTimeToTime(new_expiry_time)); 822 ppapi::PPTimeToTime(new_expiry_time));
822 } 823 }
823 824
824 void ContentDecryptorDelegate::OnSessionClosed(PP_Var session_id) { 825 void ContentDecryptorDelegate::OnSessionClosed(PP_Var session_id) {
825 if (session_closed_cb_.is_null())
826 return;
827
828 StringVar* session_id_string = StringVar::FromPPVar(session_id); 826 StringVar* session_id_string = StringVar::FromPPVar(session_id);
829 DCHECK(session_id_string); 827 DCHECK(session_id_string);
830 828
831 session_closed_cb_.Run(session_id_string->value()); 829 cdm_session_tracker_.RemoveSession(session_id_string->value());
830 if (!session_closed_cb_.is_null())
831 session_closed_cb_.Run(session_id_string->value());
832 } 832 }
833 833
834 void ContentDecryptorDelegate::DecoderInitializeDone( 834 void ContentDecryptorDelegate::DecoderInitializeDone(
835 PP_DecryptorStreamType decoder_type, 835 PP_DecryptorStreamType decoder_type,
836 uint32_t request_id, 836 uint32_t request_id,
837 PP_Bool success) { 837 PP_Bool success) {
838 if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) { 838 if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) {
839 // If the request ID is not valid or does not match what's saved, do 839 // If the request ID is not valid or does not match what's saved, do
840 // nothing. 840 // nothing.
841 if (request_id == 0 || !audio_decoder_init_cb_.Matches(request_id)) 841 if (request_id == 0 || !audio_decoder_init_cb_.Matches(request_id))
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 if (!audio_decode_cb_.is_null()) { 1251 if (!audio_decode_cb_.is_null()) {
1252 const media::Decryptor::AudioFrames empty_frames; 1252 const media::Decryptor::AudioFrames empty_frames;
1253 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, 1253 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError,
1254 empty_frames); 1254 empty_frames);
1255 } 1255 }
1256 1256
1257 if (!video_decode_cb_.is_null()) 1257 if (!video_decode_cb_.is_null())
1258 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); 1258 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL);
1259 1259
1260 cdm_promise_adapter_.Clear(); 1260 cdm_promise_adapter_.Clear();
1261
1262 cdm_session_tracker_.CloseRemainingSessions(session_closed_cb_);
1261 } 1263 }
1262 1264
1263 } // namespace content 1265 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698