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

Side by Side Diff: media/filters/ffmpeg_demuxer.cc

Issue 23072043: Change NeedKeyCB to use std::vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 "media/filters/ffmpeg_demuxer.h" 5 #include "media/filters/ffmpeg_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 return ConvertFromTimeBase(time_base, timestamp); 281 return ConvertFromTimeBase(time_base, timestamp);
282 } 282 }
283 283
284 // 284 //
285 // FFmpegDemuxer 285 // FFmpegDemuxer
286 // 286 //
287 FFmpegDemuxer::FFmpegDemuxer( 287 FFmpegDemuxer::FFmpegDemuxer(
288 const scoped_refptr<base::MessageLoopProxy>& message_loop, 288 const scoped_refptr<base::MessageLoopProxy>& message_loop,
289 DataSource* data_source, 289 DataSource* data_source,
290 const FFmpegNeedKeyCB& need_key_cb, 290 const NeedKeyCB& need_key_cb,
291 const scoped_refptr<MediaLog>& media_log) 291 const scoped_refptr<MediaLog>& media_log)
292 : host_(NULL), 292 : host_(NULL),
293 message_loop_(message_loop), 293 message_loop_(message_loop),
294 weak_factory_(this), 294 weak_factory_(this),
295 blocking_thread_("FFmpegDemuxer"), 295 blocking_thread_("FFmpegDemuxer"),
296 pending_read_(false), 296 pending_read_(false),
297 pending_seek_(false), 297 pending_seek_(false),
298 data_source_(data_source), 298 data_source_(data_source),
299 media_log_(media_log), 299 media_log_(media_log),
300 bitrate_(0), 300 bitrate_(0),
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 if (!*iter || 805 if (!*iter ||
806 (audio_disabled_ && (*iter)->type() == DemuxerStream::AUDIO)) { 806 (audio_disabled_ && (*iter)->type() == DemuxerStream::AUDIO)) {
807 continue; 807 continue;
808 } 808 }
809 (*iter)->SetEndOfStream(); 809 (*iter)->SetEndOfStream();
810 } 810 }
811 } 811 }
812 812
813 void FFmpegDemuxer::FireNeedKey(const std::string& init_data_type, 813 void FFmpegDemuxer::FireNeedKey(const std::string& init_data_type,
814 const std::string& encryption_key_id) { 814 const std::string& encryption_key_id) {
815 int key_id_size = encryption_key_id.size(); 815 size_t key_id_size = encryption_key_id.size();
816 scoped_ptr<uint8[]> key_id_local(new uint8[key_id_size]); 816 std::vector<uint8> key_id_local(key_id_size);
817 memcpy(key_id_local.get(), encryption_key_id.data(), key_id_size); 817 if (key_id_size)
818 need_key_cb_.Run(init_data_type, key_id_local.Pass(), key_id_size); 818 memcpy(&key_id_local[0], encryption_key_id.data(), key_id_size);
xhwang 2013/08/23 17:24:37 How about: std::vector<uint8> key_id_local(encryp
acolwell GONE FROM CHROMIUM 2013/08/23 19:55:28 Done. I didn't realize this would work. :)
819 need_key_cb_.Run(init_data_type, key_id_local);
819 } 820 }
820 821
821 void FFmpegDemuxer::NotifyCapacityAvailable() { 822 void FFmpegDemuxer::NotifyCapacityAvailable() {
822 DCHECK(message_loop_->BelongsToCurrentThread()); 823 DCHECK(message_loop_->BelongsToCurrentThread());
823 ReadFrameIfNeeded(); 824 ReadFrameIfNeeded();
824 } 825 }
825 826
826 void FFmpegDemuxer::NotifyBufferingChanged() { 827 void FFmpegDemuxer::NotifyBufferingChanged() {
827 DCHECK(message_loop_->BelongsToCurrentThread()); 828 DCHECK(message_loop_->BelongsToCurrentThread());
828 Ranges<base::TimeDelta> buffered; 829 Ranges<base::TimeDelta> buffered;
(...skipping 10 matching lines...) Expand all
839 } 840 }
840 for (size_t i = 0; i < buffered.size(); ++i) 841 for (size_t i = 0; i < buffered.size(); ++i)
841 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); 842 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i));
842 } 843 }
843 844
844 void FFmpegDemuxer::OnDataSourceError() { 845 void FFmpegDemuxer::OnDataSourceError() {
845 host_->OnDemuxerError(PIPELINE_ERROR_READ); 846 host_->OnDemuxerError(PIPELINE_ERROR_READ);
846 } 847 }
847 848
848 } // namespace media 849 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698