OLD | NEW |
---|---|
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 Loading... | |
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 media::Demuxer::NeedKeyCB need_key_cb = |
xhwang
2013/08/23 17:24:37
s/media:://
acolwell GONE FROM CHROMIUM
2013/08/23 19:55:28
Done.
| |
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 Loading... | |
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 NeedKeyCBMock(type, &init_data[0], init_data.size()); |
xhwang
2013/08/23 17:24:37
ditto
acolwell GONE FROM CHROMIUM
2013/08/23 19:55:28
Done.
| |
141 } | 141 } |
142 | 142 |
143 // Accessor to demuxer internals. | 143 // Accessor to demuxer internals. |
144 void set_duration_known(bool duration_known) { | 144 void set_duration_known(bool duration_known) { |
145 demuxer_->duration_known_ = duration_known; | 145 demuxer_->duration_known_ = duration_known; |
146 } | 146 } |
147 | 147 |
148 bool IsStreamStopped(DemuxerStream::Type type) { | 148 bool IsStreamStopped(DemuxerStream::Type type) { |
149 DemuxerStream* stream = demuxer_->GetStream(type); | 149 DemuxerStream* stream = demuxer_->GetStream(type); |
150 CHECK(stream); | 150 CHECK(stream); |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
575 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { | 575 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { |
576 #if !defined(USE_PROPRIETARY_CODECS) | 576 #if !defined(USE_PROPRIETARY_CODECS) |
577 return; | 577 return; |
578 #endif | 578 #endif |
579 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); | 579 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); |
580 InitializeDemuxer(); | 580 InitializeDemuxer(); |
581 ReadUntilEndOfStream(); | 581 ReadUntilEndOfStream(); |
582 } | 582 } |
583 | 583 |
584 } // namespace media | 584 } // namespace media |
OLD | NEW |