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

Side by Side Diff: media/cast/test/fake_media_source.cc

Issue 362123005: Cast: Update simulator tool with more inputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Diff Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/cast/test/fake_media_source.h" 5 #include "media/cast/test/fake_media_source.h"
6 6
7 #include "base/files/memory_mapped_file.h" 7 #include "base/files/memory_mapped_file.h"
8 #include "base/files/scoped_file.h" 8 #include "base/files/scoped_file.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 gfx::Size size(video_config_.width, video_config_.height); 233 gfx::Size size(video_config_.width, video_config_.height);
234 scoped_refptr<VideoFrame> video_frame = 234 scoped_refptr<VideoFrame> video_frame =
235 VideoFrame::CreateBlackFrame(size); 235 VideoFrame::CreateBlackFrame(size);
236 PopulateVideoFrame(video_frame, synthetic_count_); 236 PopulateVideoFrame(video_frame, synthetic_count_);
237 ++synthetic_count_; 237 ++synthetic_count_;
238 238
239 base::TimeTicks now = clock_->NowTicks(); 239 base::TimeTicks now = clock_->NowTicks();
240 if (start_time_.is_null()) 240 if (start_time_.is_null())
241 start_time_ = now; 241 start_time_ = now;
242 242
243 base::TimeDelta video_time = VideoFrameTime(video_frame_count_); 243 base::TimeDelta video_time = VideoFrameTime(++video_frame_count_);
244 video_frame->set_timestamp(video_time); 244 video_frame->set_timestamp(video_time);
245 video_frame_input_->InsertRawVideoFrame(video_frame, 245 video_frame_input_->InsertRawVideoFrame(video_frame,
246 start_time_ + video_time); 246 start_time_ + video_time);
247 247
248 // Send just enough audio data to match next video frame's time. 248 // Send just enough audio data to match next video frame's time.
249 base::TimeDelta audio_time = AudioFrameTime(audio_frame_count_); 249 base::TimeDelta audio_time = AudioFrameTime(audio_frame_count_);
250 while (audio_time < video_time) { 250 while (audio_time < video_time) {
251 if (is_transcoding_audio()) { 251 if (is_transcoding_audio()) {
252 Decode(true); 252 Decode(true);
253 CHECK(!audio_bus_queue_.empty()) << "No audio decoded."; 253 CHECK(!audio_bus_queue_.empty()) << "No audio decoded.";
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 AVCodecContext* FakeMediaSource::av_audio_context() { 585 AVCodecContext* FakeMediaSource::av_audio_context() {
586 return av_audio_stream()->codec; 586 return av_audio_stream()->codec;
587 } 587 }
588 588
589 AVCodecContext* FakeMediaSource::av_video_context() { 589 AVCodecContext* FakeMediaSource::av_video_context() {
590 return av_video_stream()->codec; 590 return av_video_stream()->codec;
591 } 591 }
592 592
593 } // namespace cast 593 } // namespace cast
594 } // namespace media 594 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698