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

Side by Side Diff: chromecast/renderer/media/demuxer_stream_for_test.cc

Issue 1372393007: [Chromecast] Upgrade to new CMA backend API (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Address alokp@ comments Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/threading/thread.h" 5 #include "base/threading/thread.h"
6 #include "chromecast/media/cma/test/demuxer_stream_for_test.h" 6 #include "chromecast/renderer/media/demuxer_stream_for_test.h"
7 7
8 namespace chromecast { 8 namespace chromecast {
9 namespace media { 9 namespace media {
10 10
11 DemuxerStreamForTest::DemuxerStreamForTest(int total_frames, 11 DemuxerStreamForTest::DemuxerStreamForTest(int total_frames,
12 int cycle_count, 12 int cycle_count,
13 int delayed_frame_count, 13 int delayed_frame_count,
14 const std::list<int>& config_idx) 14 const std::list<int>& config_idx)
15 : total_frame_count_(total_frames), 15 : total_frame_count_(total_frames),
16 cycle_count_(cycle_count), 16 cycle_count_(cycle_count),
(...skipping 11 matching lines...) Expand all
28 has_pending_read_ = true; 28 has_pending_read_ = true;
29 if (!config_idx_.empty() && config_idx_.front() == frame_count_) { 29 if (!config_idx_.empty() && config_idx_.front() == frame_count_) {
30 config_idx_.pop_front(); 30 config_idx_.pop_front();
31 has_pending_read_ = false; 31 has_pending_read_ = false;
32 read_cb.Run(kConfigChanged, scoped_refptr<::media::DecoderBuffer>()); 32 read_cb.Run(kConfigChanged, scoped_refptr<::media::DecoderBuffer>());
33 return; 33 return;
34 } 34 }
35 35
36 if ((frame_count_ % cycle_count_) < delayed_frame_count_) { 36 if ((frame_count_ % cycle_count_) < delayed_frame_count_) {
37 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 37 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
38 FROM_HERE, base::Bind(&DemuxerStreamForTest::DoRead, 38 FROM_HERE,
39 base::Unretained(this), read_cb), 39 base::Bind(
40 &DemuxerStreamForTest::DoRead, base::Unretained(this), read_cb),
40 base::TimeDelta::FromMilliseconds(20)); 41 base::TimeDelta::FromMilliseconds(20));
41 return; 42 return;
42 } 43 }
43 DoRead(read_cb); 44 DoRead(read_cb);
44 } 45 }
45 46
46 ::media::AudioDecoderConfig DemuxerStreamForTest::audio_decoder_config() { 47 ::media::AudioDecoderConfig DemuxerStreamForTest::audio_decoder_config() {
47 NOTREACHED() << "DemuxerStreamForTest is a video DemuxerStream"; 48 NOTREACHED() << "DemuxerStreamForTest is a video DemuxerStream";
48 return ::media::AudioDecoderConfig(); 49 return ::media::AudioDecoderConfig();
49 } 50 }
50 51
51 ::media::VideoDecoderConfig DemuxerStreamForTest::video_decoder_config() { 52 ::media::VideoDecoderConfig DemuxerStreamForTest::video_decoder_config() {
52 gfx::Size coded_size(640, 480); 53 gfx::Size coded_size(640, 480);
53 gfx::Rect visible_rect(640, 480); 54 gfx::Rect visible_rect(640, 480);
54 gfx::Size natural_size(640, 480); 55 gfx::Size natural_size(640, 480);
55 return ::media::VideoDecoderConfig( 56 return ::media::VideoDecoderConfig(::media::kCodecH264,
56 ::media::kCodecH264, ::media::VIDEO_CODEC_PROFILE_UNKNOWN, 57 ::media::VIDEO_CODEC_PROFILE_UNKNOWN,
57 ::media::PIXEL_FORMAT_YV12, ::media::COLOR_SPACE_UNSPECIFIED, coded_size, 58 ::media::PIXEL_FORMAT_YV12,
58 visible_rect, natural_size, NULL, 0, false); 59 ::media::COLOR_SPACE_UNSPECIFIED,
60 coded_size,
61 visible_rect,
62 natural_size,
63 NULL,
64 0,
65 false);
59 } 66 }
60 67
61 ::media::DemuxerStream::Type DemuxerStreamForTest::type() const { 68 ::media::DemuxerStream::Type DemuxerStreamForTest::type() const {
62 return VIDEO; 69 return VIDEO;
63 } 70 }
64 71
65 bool DemuxerStreamForTest::SupportsConfigChanges() { 72 bool DemuxerStreamForTest::SupportsConfigChanges() {
66 return true; 73 return true;
67 } 74 }
68 75
(...skipping 12 matching lines...) Expand all
81 88
82 scoped_refptr<::media::DecoderBuffer> buffer(new ::media::DecoderBuffer(16)); 89 scoped_refptr<::media::DecoderBuffer> buffer(new ::media::DecoderBuffer(16));
83 buffer->set_timestamp(frame_count_ * base::TimeDelta::FromMilliseconds( 90 buffer->set_timestamp(frame_count_ * base::TimeDelta::FromMilliseconds(
84 kDemuxerStreamForTestFrameDuration)); 91 kDemuxerStreamForTestFrameDuration));
85 frame_count_++; 92 frame_count_++;
86 read_cb.Run(kOk, buffer); 93 read_cb.Run(kOk, buffer);
87 } 94 }
88 95
89 } // namespace media 96 } // namespace media
90 } // namespace chromecast 97 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/renderer/media/demuxer_stream_for_test.h ('k') | chromecast/renderer/media/hole_frame_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698