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

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

Issue 2133903002: RELAND: Merge VideoSenderConfig and AudioSenderConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabled two unittests. Created 4 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
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/cast/test/fake_media_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // A fake media source that generates video and audio frames to a cast 5 // A fake media source that generates video and audio frames to a cast
6 // sender. 6 // sender.
7 // This class can transcode a WebM file using FFmpeg. It can also 7 // This class can transcode a WebM file using FFmpeg. It can also
8 // generate an animation and audio of fixed frequency. 8 // generate an animation and audio of fixed frequency.
9 9
10 #ifndef MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_ 10 #ifndef MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 class FakeMediaSource : public media::AudioConverter::InputCallback { 49 class FakeMediaSource : public media::AudioConverter::InputCallback {
50 public: 50 public:
51 // |task_runner| is to schedule decoding tasks. 51 // |task_runner| is to schedule decoding tasks.
52 // |clock| is used by this source but is not owned. 52 // |clock| is used by this source but is not owned.
53 // |audio_config| is the desired audio config. 53 // |audio_config| is the desired audio config.
54 // |video_config| is the desired video config. 54 // |video_config| is the desired video config.
55 // |keep_frames| is true if all VideoFrames are saved in a queue. 55 // |keep_frames| is true if all VideoFrames are saved in a queue.
56 FakeMediaSource(scoped_refptr<base::SingleThreadTaskRunner> task_runner, 56 FakeMediaSource(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
57 base::TickClock* clock, 57 base::TickClock* clock,
58 const AudioSenderConfig& audio_config, 58 const FrameSenderConfig& audio_config,
59 const VideoSenderConfig& video_config, 59 const FrameSenderConfig& video_config,
60 bool keep_frames); 60 bool keep_frames);
61 ~FakeMediaSource() final; 61 ~FakeMediaSource() final;
62 62
63 // Transcode this file as the source of video and audio frames. 63 // Transcode this file as the source of video and audio frames.
64 // If |final_fps| is non zero then the file is played at the desired rate. 64 // If |final_fps| is non zero then the file is played at the desired rate.
65 void SetSourceFile(const base::FilePath& video_file, int final_fps); 65 void SetSourceFile(const base::FilePath& video_file, int final_fps);
66 66
67 // Set to true to randomly change the frame size at random points in time. 67 // Set to true to randomly change the frame size at random points in time.
68 // Only applies when SetSourceFile() is not used. 68 // Only applies when SetSourceFile() is not used.
69 void SetVariableFrameSizeMode(bool enabled); 69 void SetVariableFrameSizeMode(bool enabled);
70 70
71 void Start(scoped_refptr<AudioFrameInput> audio_frame_input, 71 void Start(scoped_refptr<AudioFrameInput> audio_frame_input,
72 scoped_refptr<VideoFrameInput> video_frame_input); 72 scoped_refptr<VideoFrameInput> video_frame_input);
73 73
74 const VideoSenderConfig& get_video_config() const { return video_config_; } 74 const FrameSenderConfig& get_video_config() const { return video_config_; }
75 75
76 scoped_refptr<media::VideoFrame> PopOldestInsertedVideoFrame(); 76 scoped_refptr<media::VideoFrame> PopOldestInsertedVideoFrame();
77 77
78 private: 78 private:
79 bool is_transcoding_audio() const { return audio_stream_index_ >= 0; } 79 bool is_transcoding_audio() const { return audio_stream_index_ >= 0; }
80 bool is_transcoding_video() const { return video_stream_index_ >= 0; } 80 bool is_transcoding_video() const { return video_stream_index_ >= 0; }
81 81
82 void SendNextFrame(); 82 void SendNextFrame();
83 void SendNextFakeFrame(); 83 void SendNextFakeFrame();
84 84
(...skipping 26 matching lines...) Expand all
111 double ProvideInput(media::AudioBus* output_bus, 111 double ProvideInput(media::AudioBus* output_bus,
112 uint32_t frames_delayed) final; 112 uint32_t frames_delayed) final;
113 113
114 AVStream* av_audio_stream(); 114 AVStream* av_audio_stream();
115 AVStream* av_video_stream(); 115 AVStream* av_video_stream();
116 AVCodecContext* av_audio_context(); 116 AVCodecContext* av_audio_context();
117 AVCodecContext* av_video_context(); 117 AVCodecContext* av_video_context();
118 118
119 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 119 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
120 const media::AudioParameters output_audio_params_; 120 const media::AudioParameters output_audio_params_;
121 const VideoSenderConfig video_config_; 121 const FrameSenderConfig video_config_;
122 const bool keep_frames_; 122 const bool keep_frames_;
123 bool variable_frame_size_mode_; 123 bool variable_frame_size_mode_;
124 gfx::Size current_frame_size_; 124 gfx::Size current_frame_size_;
125 base::TimeTicks next_frame_size_change_time_; 125 base::TimeTicks next_frame_size_change_time_;
126 scoped_refptr<AudioFrameInput> audio_frame_input_; 126 scoped_refptr<AudioFrameInput> audio_frame_input_;
127 scoped_refptr<VideoFrameInput> video_frame_input_; 127 scoped_refptr<VideoFrameInput> video_frame_input_;
128 uint8_t synthetic_count_; 128 uint8_t synthetic_count_;
129 base::TickClock* const clock_; // Not owned by this class. 129 base::TickClock* const clock_; // Not owned by this class.
130 130
131 // Time when the stream starts. 131 // Time when the stream starts.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // NOTE: Weak pointers must be invalidated before all other member variables. 169 // NOTE: Weak pointers must be invalidated before all other member variables.
170 base::WeakPtrFactory<FakeMediaSource> weak_factory_; 170 base::WeakPtrFactory<FakeMediaSource> weak_factory_;
171 171
172 DISALLOW_COPY_AND_ASSIGN(FakeMediaSource); 172 DISALLOW_COPY_AND_ASSIGN(FakeMediaSource);
173 }; 173 };
174 174
175 } // namespace cast 175 } // namespace cast
176 } // namespace media 176 } // namespace media
177 177
178 #endif // MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_ 178 #endif // MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_
OLDNEW
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/cast/test/fake_media_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698