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

Side by Side Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 23072043: Change NeedKeyCB to use std::vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix seek_tester, demuxer_bench, and player_x11 Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/webmediaplayer_impl.h ('k') | media/base/demuxer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/renderer/media/webmediaplayer_impl.h" 5 #include "content/renderer/media/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 916
917 void WebMediaPlayerImpl::OnKeyAdded(const std::string& session_id) { 917 void WebMediaPlayerImpl::OnKeyAdded(const std::string& session_id) {
918 DCHECK(main_loop_->BelongsToCurrentThread()); 918 DCHECK(main_loop_->BelongsToCurrentThread());
919 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); 919 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1);
920 GetClient()->keyAdded(current_key_system_, 920 GetClient()->keyAdded(current_key_system_,
921 WebString::fromUTF8(session_id)); 921 WebString::fromUTF8(session_id));
922 } 922 }
923 923
924 void WebMediaPlayerImpl::OnNeedKey(const std::string& session_id, 924 void WebMediaPlayerImpl::OnNeedKey(const std::string& session_id,
925 const std::string& type, 925 const std::string& type,
926 scoped_ptr<uint8[]> init_data, 926 const std::vector<uint8>& init_data) {
927 int init_data_size) {
928 DCHECK(main_loop_->BelongsToCurrentThread()); 927 DCHECK(main_loop_->BelongsToCurrentThread());
929 928
930 // Do not fire NeedKey event if encrypted media is not enabled. 929 // Do not fire NeedKey event if encrypted media is not enabled.
931 if (!decryptor_) 930 if (!decryptor_)
932 return; 931 return;
933 932
934 UMA_HISTOGRAM_COUNTS(kMediaEme + std::string("NeedKey"), 1); 933 UMA_HISTOGRAM_COUNTS(kMediaEme + std::string("NeedKey"), 1);
935 934
936 DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_); 935 DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_);
937 if (init_data_type_.empty()) 936 if (init_data_type_.empty())
938 init_data_type_ = type; 937 init_data_type_ = type;
939 938
939 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0];
940 GetClient()->keyNeeded(WebString(), 940 GetClient()->keyNeeded(WebString(),
941 WebString::fromUTF8(session_id), 941 WebString::fromUTF8(session_id),
942 init_data.get(), 942 init_data_ptr,
943 init_data_size); 943 init_data.size());
944 } 944 }
945 945
946 scoped_ptr<media::TextTrack> 946 scoped_ptr<media::TextTrack>
947 WebMediaPlayerImpl::OnTextTrack(media::TextKind kind, 947 WebMediaPlayerImpl::OnTextTrack(media::TextKind kind,
948 const std::string& label, 948 const std::string& label,
949 const std::string& language) { 949 const std::string& language) {
950 typedef WebInbandTextTrackImpl::Kind webkind_t; 950 typedef WebInbandTextTrackImpl::Kind webkind_t;
951 const webkind_t webkind = static_cast<webkind_t>(kind); 951 const webkind_t webkind = static_cast<webkind_t>(kind);
952 const WebKit::WebString weblabel = WebKit::WebString::fromUTF8(label); 952 const WebKit::WebString weblabel = WebKit::WebString::fromUTF8(label);
953 const WebKit::WebString weblanguage = WebKit::WebString::fromUTF8(language); 953 const WebKit::WebString weblanguage = WebKit::WebString::fromUTF8(language);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 1237
1238 if (pending_repaint_) 1238 if (pending_repaint_)
1239 return; 1239 return;
1240 1240
1241 pending_repaint_ = true; 1241 pending_repaint_ = true;
1242 main_loop_->PostTask(FROM_HERE, base::Bind( 1242 main_loop_->PostTask(FROM_HERE, base::Bind(
1243 &WebMediaPlayerImpl::Repaint, AsWeakPtr())); 1243 &WebMediaPlayerImpl::Repaint, AsWeakPtr()));
1244 } 1244 }
1245 1245
1246 } // namespace content 1246 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webmediaplayer_impl.h ('k') | media/base/demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698