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

Side by Side Diff: media/filters/ffmpeg_demuxer_unittest.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 | « media/filters/ffmpeg_demuxer.cc ('k') | media/filters/pipeline_integration_test.cc » ('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 (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 <algorithm> 5 #include <algorithm>
6 #include <deque> 6 #include <deque>
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 void CreateDemuxer(const std::string& name) { 75 void CreateDemuxer(const std::string& name) {
76 CHECK(!demuxer_); 76 CHECK(!demuxer_);
77 77
78 EXPECT_CALL(host_, SetTotalBytes(_)).Times(AnyNumber()); 78 EXPECT_CALL(host_, SetTotalBytes(_)).Times(AnyNumber());
79 EXPECT_CALL(host_, AddBufferedByteRange(_, _)).Times(AnyNumber()); 79 EXPECT_CALL(host_, AddBufferedByteRange(_, _)).Times(AnyNumber());
80 EXPECT_CALL(host_, AddBufferedTimeRange(_, _)).Times(AnyNumber()); 80 EXPECT_CALL(host_, AddBufferedTimeRange(_, _)).Times(AnyNumber());
81 81
82 CreateDataSource(name); 82 CreateDataSource(name);
83 83
84 media::FFmpegNeedKeyCB need_key_cb = 84 Demuxer::NeedKeyCB need_key_cb =
85 base::Bind(&FFmpegDemuxerTest::NeedKeyCB, base::Unretained(this)); 85 base::Bind(&FFmpegDemuxerTest::NeedKeyCB, base::Unretained(this));
86 demuxer_.reset(new FFmpegDemuxer(message_loop_.message_loop_proxy(), 86 demuxer_.reset(new FFmpegDemuxer(message_loop_.message_loop_proxy(),
87 data_source_.get(), 87 data_source_.get(),
88 need_key_cb, 88 need_key_cb,
89 new MediaLog())); 89 new MediaLog()));
90 } 90 }
91 91
92 MOCK_METHOD1(CheckPoint, void(int v)); 92 MOCK_METHOD1(CheckPoint, void(int v));
93 93
94 void InitializeDemuxer() { 94 void InitializeDemuxer() {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 location, size, timestampInMicroseconds); 129 location, size, timestampInMicroseconds);
130 } 130 }
131 131
132 // TODO(xhwang): This is a workaround of the issue that move-only parameters 132 // TODO(xhwang): This is a workaround of the issue that move-only parameters
133 // are not supported in mocked methods. Remove this when the issue is fixed 133 // are not supported in mocked methods. Remove this when the issue is fixed
134 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use 134 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use
135 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689). 135 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689).
136 MOCK_METHOD3(NeedKeyCBMock, void(const std::string& type, 136 MOCK_METHOD3(NeedKeyCBMock, void(const std::string& type,
137 const uint8* init_data, int init_data_size)); 137 const uint8* init_data, int init_data_size));
138 void NeedKeyCB(const std::string& type, 138 void NeedKeyCB(const std::string& type,
139 scoped_ptr<uint8[]> init_data, int init_data_size) { 139 const std::vector<uint8>& init_data) {
140 NeedKeyCBMock(type, init_data.get(), init_data_size); 140 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0];
141 NeedKeyCBMock(type, init_data_ptr, init_data.size());
141 } 142 }
142 143
143 // Accessor to demuxer internals. 144 // Accessor to demuxer internals.
144 void set_duration_known(bool duration_known) { 145 void set_duration_known(bool duration_known) {
145 demuxer_->duration_known_ = duration_known; 146 demuxer_->duration_known_ = duration_known;
146 } 147 }
147 148
148 bool IsStreamStopped(DemuxerStream::Type type) { 149 bool IsStreamStopped(DemuxerStream::Type type) {
149 DemuxerStream* stream = demuxer_->GetStream(type); 150 DemuxerStream* stream = demuxer_->GetStream(type);
150 CHECK(stream); 151 CHECK(stream);
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { 576 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) {
576 #if !defined(USE_PROPRIETARY_CODECS) 577 #if !defined(USE_PROPRIETARY_CODECS)
577 return; 578 return;
578 #endif 579 #endif
579 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); 580 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4");
580 InitializeDemuxer(); 581 InitializeDemuxer();
581 ReadUntilEndOfStream(); 582 ReadUntilEndOfStream();
582 } 583 }
583 584
584 } // namespace media 585 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698