| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 namespace media { | 73 namespace media { |
| 74 namespace cast { | 74 namespace cast { |
| 75 | 75 |
| 76 FakeMediaSource::FakeMediaSource( | 76 FakeMediaSource::FakeMediaSource( |
| 77 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 77 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 78 base::TickClock* clock, | 78 base::TickClock* clock, |
| 79 const AudioSenderConfig& audio_config, | 79 const FrameSenderConfig& audio_config, |
| 80 const VideoSenderConfig& video_config, | 80 const FrameSenderConfig& video_config, |
| 81 bool keep_frames) | 81 bool keep_frames) |
| 82 : task_runner_(task_runner), | 82 : task_runner_(task_runner), |
| 83 output_audio_params_(AudioParameters::AUDIO_PCM_LINEAR, | 83 output_audio_params_(AudioParameters::AUDIO_PCM_LINEAR, |
| 84 media::GuessChannelLayout(audio_config.channels), | 84 media::GuessChannelLayout(audio_config.channels), |
| 85 audio_config.frequency, | 85 audio_config.rtp_timebase, |
| 86 32, | 86 32, |
| 87 audio_config.frequency / kAudioPacketsPerSecond), | 87 audio_config.rtp_timebase / kAudioPacketsPerSecond), |
| 88 video_config_(video_config), | 88 video_config_(video_config), |
| 89 keep_frames_(keep_frames), | 89 keep_frames_(keep_frames), |
| 90 variable_frame_size_mode_(false), | 90 variable_frame_size_mode_(false), |
| 91 synthetic_count_(0), | 91 synthetic_count_(0), |
| 92 clock_(clock), | 92 clock_(clock), |
| 93 audio_frame_count_(0), | 93 audio_frame_count_(0), |
| 94 video_frame_count_(0), | 94 video_frame_count_(0), |
| 95 av_format_context_(NULL), | 95 av_format_context_(NULL), |
| 96 audio_stream_index_(-1), | 96 audio_stream_index_(-1), |
| 97 playback_rate_(1.0), | 97 playback_rate_(1.0), |
| 98 video_stream_index_(-1), | 98 video_stream_index_(-1), |
| 99 video_frame_rate_numerator_(video_config.max_frame_rate), | 99 video_frame_rate_numerator_(video_config.max_frame_rate), |
| 100 video_frame_rate_denominator_(1), | 100 video_frame_rate_denominator_(1), |
| 101 video_first_pts_(0), | 101 video_first_pts_(0), |
| 102 video_first_pts_set_(false), | 102 video_first_pts_set_(false), |
| 103 weak_factory_(this) { | 103 weak_factory_(this) { |
| 104 CHECK(output_audio_params_.IsValid()); | 104 CHECK(output_audio_params_.IsValid()); |
| 105 audio_bus_factory_.reset(new TestAudioBusFactory(audio_config.channels, | 105 audio_bus_factory_.reset( |
| 106 audio_config.frequency, | 106 new TestAudioBusFactory(audio_config.channels, audio_config.rtp_timebase, |
| 107 kSoundFrequency, | 107 kSoundFrequency, kSoundVolume)); |
| 108 kSoundVolume)); | |
| 109 } | 108 } |
| 110 | 109 |
| 111 FakeMediaSource::~FakeMediaSource() { | 110 FakeMediaSource::~FakeMediaSource() { |
| 112 } | 111 } |
| 113 | 112 |
| 114 void FakeMediaSource::SetSourceFile(const base::FilePath& video_file, | 113 void FakeMediaSource::SetSourceFile(const base::FilePath& video_file, |
| 115 int final_fps) { | 114 int final_fps) { |
| 116 DCHECK(!video_file.empty()); | 115 DCHECK(!video_file.empty()); |
| 117 | 116 |
| 118 LOG(INFO) << "Source: " << video_file.value(); | 117 LOG(INFO) << "Source: " << video_file.value(); |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 AVCodecContext* FakeMediaSource::av_audio_context() { | 622 AVCodecContext* FakeMediaSource::av_audio_context() { |
| 624 return av_audio_stream()->codec; | 623 return av_audio_stream()->codec; |
| 625 } | 624 } |
| 626 | 625 |
| 627 AVCodecContext* FakeMediaSource::av_video_context() { | 626 AVCodecContext* FakeMediaSource::av_video_context() { |
| 628 return av_video_stream()->codec; | 627 return av_video_stream()->codec; |
| 629 } | 628 } |
| 630 | 629 |
| 631 } // namespace cast | 630 } // namespace cast |
| 632 } // namespace media | 631 } // namespace media |
| OLD | NEW |