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

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

Issue 1512173003: media: Refactor MediaCrypto creation and notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fire pending callback in dtor Created 5 years 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 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 "base/barrier_closure.h" 7 #include "base/barrier_closure.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 bool needs_protected_surface) { 930 bool needs_protected_surface) {
931 DCHECK(GetMediaTaskRunner()->BelongsToCurrentThread()); 931 DCHECK(GetMediaTaskRunner()->BelongsToCurrentThread());
932 DVLOG(1) << __FUNCTION__ << " protected surface is " 932 DVLOG(1) << __FUNCTION__ << " protected surface is "
933 << (needs_protected_surface ? "required" : "not required"); 933 << (needs_protected_surface ? "required" : "not required");
934 934
935 // We use the parameters that come with this callback every time we call 935 // We use the parameters that come with this callback every time we call
936 // Configure(). This is possible only if the MediaCrypto object remains valid 936 // Configure(). This is possible only if the MediaCrypto object remains valid
937 // and the surface requirement does not change until new SetCdm() is called. 937 // and the surface requirement does not change until new SetCdm() is called.
938 938
939 DCHECK(media_crypto); 939 DCHECK(media_crypto);
940 DCHECK(!media_crypto->is_null()); 940
941 if (media_crypto->is_null()) {
942 // TODO(timav): Fail playback nicely here.
943 LOG(ERROR) << "MediaCrypto creation failed.";
944 return;
945 }
941 946
942 media_crypto_ = media_crypto.Pass(); 947 media_crypto_ = media_crypto.Pass();
943 948
944 if (audio_decoder_) { 949 if (audio_decoder_) {
945 audio_decoder_->SetNeedsReconfigure(); 950 audio_decoder_->SetNeedsReconfigure();
946 } 951 }
947 952
948 if (video_decoder_) { 953 if (video_decoder_) {
949 video_decoder_->SetNeedsReconfigure(); 954 video_decoder_->SetNeedsReconfigure();
950 video_decoder_->SetProtectedSurfaceRequired(needs_protected_surface); 955 video_decoder_->SetProtectedSurfaceRequired(needs_protected_surface);
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 RETURN_STRING(kStateWaitingForMediaCrypto); 1403 RETURN_STRING(kStateWaitingForMediaCrypto);
1399 RETURN_STRING(kStateWaitingForSeek); 1404 RETURN_STRING(kStateWaitingForSeek);
1400 RETURN_STRING(kStateError); 1405 RETURN_STRING(kStateError);
1401 } 1406 }
1402 return nullptr; // crash early 1407 return nullptr; // crash early
1403 } 1408 }
1404 1409
1405 #undef RETURN_STRING 1410 #undef RETURN_STRING
1406 1411
1407 } // namespace media 1412 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698