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

Side by Side Diff: media/base/fake_demuxer_stream.cc

Issue 2491043003: MediaResource refactoring to support multiple streams (Closed)
Patch Set: rebase Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "media/base/fake_demuxer_stream.h" 5 #include "media/base/fake_demuxer_stream.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 105
106 bool FakeDemuxerStream::enabled() const { 106 bool FakeDemuxerStream::enabled() const {
107 return true; 107 return true;
108 } 108 }
109 109
110 void FakeDemuxerStream::set_enabled(bool enabled, base::TimeDelta timestamp) { 110 void FakeDemuxerStream::set_enabled(bool enabled, base::TimeDelta timestamp) {
111 NOTIMPLEMENTED(); 111 NOTIMPLEMENTED();
112 } 112 }
113 113
114 void FakeDemuxerStream::SetStreamStatusChangeCB(
115 const StreamStatusChangeCB& cb) {
116 NOTIMPLEMENTED();
117 }
118
119 void FakeDemuxerStream::HoldNextRead() { 114 void FakeDemuxerStream::HoldNextRead() {
120 DCHECK(task_runner_->BelongsToCurrentThread()); 115 DCHECK(task_runner_->BelongsToCurrentThread());
121 read_to_hold_ = next_read_num_; 116 read_to_hold_ = next_read_num_;
122 } 117 }
123 118
124 void FakeDemuxerStream::HoldNextConfigChangeRead() { 119 void FakeDemuxerStream::HoldNextConfigChangeRead() {
125 DCHECK(task_runner_->BelongsToCurrentThread()); 120 DCHECK(task_runner_->BelongsToCurrentThread());
126 // Set |read_to_hold_| to be the next config change read. 121 // Set |read_to_hold_| to be the next config change read.
127 read_to_hold_ = next_read_num_ + num_buffers_in_one_config_ - 122 read_to_hold_ = next_read_num_ + num_buffers_in_one_config_ -
128 next_read_num_ % (num_buffers_in_one_config_ + 1); 123 next_read_num_ % (num_buffers_in_one_config_ + 1);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 current_timestamp_ += duration_; 203 current_timestamp_ += duration_;
209 204
210 num_buffers_left_in_current_config_--; 205 num_buffers_left_in_current_config_--;
211 if (num_buffers_left_in_current_config_ == 0) 206 if (num_buffers_left_in_current_config_ == 0)
212 num_configs_left_--; 207 num_configs_left_--;
213 208
214 num_buffers_returned_++; 209 num_buffers_returned_++;
215 base::ResetAndReturn(&read_cb_).Run(kOk, buffer); 210 base::ResetAndReturn(&read_cb_).Run(kOk, buffer);
216 } 211 }
217 212
218 FakeDemuxerStreamProvider::FakeDemuxerStreamProvider( 213 FakeMediaResource::FakeMediaResource(int num_video_configs,
219 int num_video_configs, 214 int num_video_buffers_in_one_config,
220 int num_video_buffers_in_one_config, 215 bool is_video_encrypted)
221 bool is_video_encrypted)
222 : fake_video_stream_(num_video_configs, 216 : fake_video_stream_(num_video_configs,
223 num_video_buffers_in_one_config, 217 num_video_buffers_in_one_config,
224 is_video_encrypted) { 218 is_video_encrypted) {}
219
220 FakeMediaResource::~FakeMediaResource() {}
221
222 std::vector<DemuxerStream*> FakeMediaResource::GetStreams() {
223 std::vector<DemuxerStream*> result;
224 result.push_back(&fake_video_stream_);
225 return result;
225 } 226 }
226 227
227 FakeDemuxerStreamProvider::~FakeDemuxerStreamProvider() { 228 void FakeMediaResource::SetStreamStatusChangeCB(
229 const StreamStatusChangeCB& cb) {
230 NOTIMPLEMENTED();
228 } 231 }
229 232
230 DemuxerStream* FakeDemuxerStreamProvider::GetStream(DemuxerStream::Type type) {
231 if (type == DemuxerStream::Type::AUDIO)
232 return nullptr;
233 return &fake_video_stream_;
234 };
235 233
236 } // namespace media 234 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698