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

Side by Side Diff: media/test/pipeline_integration_test_base.cc

Issue 2050043002: Generate and assign media track ids in demuxers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-streamparser-trackid
Patch Set: rebase to ToT Created 4 years, 6 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) 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/test/pipeline_integration_test_base.h" 5 #include "media/test/pipeline_integration_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 EmeInitDataType type, 77 EmeInitDataType type,
78 const std::vector<uint8_t>& init_data) { 78 const std::vector<uint8_t>& init_data) {
79 DCHECK(!init_data.empty()); 79 DCHECK(!init_data.empty());
80 CHECK(!encrypted_media_init_data_cb_.is_null()); 80 CHECK(!encrypted_media_init_data_cb_.is_null());
81 encrypted_media_init_data_cb_.Run(type, init_data); 81 encrypted_media_init_data_cb_.Run(type, init_data);
82 } 82 }
83 83
84 void PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB( 84 void PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB(
85 std::unique_ptr<MediaTracks> tracks) { 85 std::unique_ptr<MediaTracks> tracks) {
86 CHECK(tracks); 86 CHECK(tracks);
87 CHECK_GT(tracks->tracks().size(), 0u);
88
89 // Verify that track ids are unique.
90 std::set<MediaTrack::Id> track_ids;
91 for (const auto& track : tracks->tracks()) {
92 EXPECT_EQ(track_ids.end(), track_ids.find(track->id()));
93 track_ids.insert(track->id());
94 }
87 } 95 }
88 96
89 void PipelineIntegrationTestBase::OnEnded() { 97 void PipelineIntegrationTestBase::OnEnded() {
90 DCHECK(!ended_); 98 DCHECK(!ended_);
91 ended_ = true; 99 ended_ = true;
92 pipeline_status_ = PIPELINE_OK; 100 pipeline_status_ = PIPELINE_OK;
93 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 101 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
94 } 102 }
95 103
96 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { 104 bool PipelineIntegrationTestBase::WaitUntilOnEnded() {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 base::Unretained(this), wait_time), 267 base::Unretained(this), wait_time),
260 base::TimeDelta::FromMilliseconds(10)); 268 base::TimeDelta::FromMilliseconds(10));
261 message_loop_.Run(); 269 message_loop_.Run();
262 return (pipeline_status_ == PIPELINE_OK); 270 return (pipeline_status_ == PIPELINE_OK);
263 } 271 }
264 272
265 void PipelineIntegrationTestBase::CreateDemuxer( 273 void PipelineIntegrationTestBase::CreateDemuxer(
266 std::unique_ptr<DataSource> data_source) { 274 std::unique_ptr<DataSource> data_source) {
267 data_source_ = std::move(data_source); 275 data_source_ = std::move(data_source);
268 276
269 Demuxer::MediaTracksUpdatedCB tracks_updated_cb =
270 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB,
271 base::Unretained(this));
272
273 #if !defined(MEDIA_DISABLE_FFMPEG) 277 #if !defined(MEDIA_DISABLE_FFMPEG)
274 demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer( 278 demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer(
275 message_loop_.task_runner(), data_source_.get(), 279 message_loop_.task_runner(), data_source_.get(),
276 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, 280 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB,
277 base::Unretained(this)), 281 base::Unretained(this)),
278 tracks_updated_cb, new MediaLog())); 282 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB,
283 base::Unretained(this)),
284 new MediaLog()));
279 #endif 285 #endif
280 } 286 }
281 287
282 std::unique_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { 288 std::unique_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() {
283 ScopedVector<VideoDecoder> video_decoders; 289 ScopedVector<VideoDecoder> video_decoders;
284 #if !defined(MEDIA_DISABLE_LIBVPX) 290 #if !defined(MEDIA_DISABLE_LIBVPX)
285 video_decoders.push_back(new VpxVideoDecoder()); 291 video_decoders.push_back(new VpxVideoDecoder());
286 #endif // !defined(MEDIA_DISABLE_LIBVPX) 292 #endif // !defined(MEDIA_DISABLE_LIBVPX)
287 293
288 #if !defined(MEDIA_DISABLE_FFMPEG) 294 #if !defined(MEDIA_DISABLE_FFMPEG)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 DCHECK(clockless_playback_); 388 DCHECK(clockless_playback_);
383 return clockless_audio_sink_->render_time(); 389 return clockless_audio_sink_->render_time();
384 } 390 }
385 391
386 base::TimeTicks DummyTickClock::NowTicks() { 392 base::TimeTicks DummyTickClock::NowTicks() {
387 now_ += base::TimeDelta::FromSeconds(60); 393 now_ += base::TimeDelta::FromSeconds(60);
388 return now_; 394 return now_;
389 } 395 }
390 396
391 } // namespace media 397 } // namespace media
OLDNEW
« no previous file with comments | « media/test/pipeline_integration_test.cc ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698