OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <random> | 8 #include <random> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 base::RunLoop run_loop; | 58 base::RunLoop run_loop; |
59 run_loop.RunUntilIdle(); | 59 run_loop.RunUntilIdle(); |
60 | 60 |
61 int num_iterations = kMinNumIterations + rng() % kMaxNumIterations; | 61 int num_iterations = kMinNumIterations + rng() % kMaxNumIterations; |
62 do { | 62 do { |
63 if (input_type.has_video) { | 63 if (input_type.has_video) { |
64 // VideoFrames cannot be arbitrarily small. | 64 // VideoFrames cannot be arbitrarily small. |
65 const auto visible_rect = gfx::Size(16 + rng() % 128, 16 + rng() % 128); | 65 const auto visible_rect = gfx::Size(16 + rng() % 128, 16 + rng() % 128); |
66 const auto video_frame = VideoFrame::CreateBlackFrame(visible_rect); | 66 const auto video_frame = VideoFrame::CreateBlackFrame(visible_rect); |
67 const auto is_key_frame = rng() % 2; | 67 const auto is_key_frame = rng() % 2; |
68 muxer.OnEncodedVideo(video_frame, base::MakeUnique<std::string>(str), | 68 muxer.OnEncodedVideo(WebmMuxer::VideoParameters(video_frame), |
| 69 base::MakeUnique<std::string>(str), |
69 base::TimeTicks(), is_key_frame); | 70 base::TimeTicks(), is_key_frame); |
70 base::RunLoop run_loop; | 71 base::RunLoop run_loop; |
71 run_loop.RunUntilIdle(); | 72 run_loop.RunUntilIdle(); |
72 } | 73 } |
73 | 74 |
74 if (input_type.has_audio) { | 75 if (input_type.has_audio) { |
75 const ChannelLayout layout = rng() % 2 ? media::CHANNEL_LAYOUT_STEREO | 76 const ChannelLayout layout = rng() % 2 ? media::CHANNEL_LAYOUT_STEREO |
76 : media::CHANNEL_LAYOUT_MONO; | 77 : media::CHANNEL_LAYOUT_MONO; |
77 const int sample_rate = | 78 const int sample_rate = |
78 kSampleRatesInKHz[rng() % arraysize(kSampleRatesInKHz)]; | 79 kSampleRatesInKHz[rng() % arraysize(kSampleRatesInKHz)]; |
79 | 80 |
80 const AudioParameters params( | 81 const AudioParameters params( |
81 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, sample_rate, | 82 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, sample_rate, |
82 16 /* bits_per_sample */, 60 * sample_rate); | 83 16 /* bits_per_sample */, 60 * sample_rate); |
83 muxer.OnEncodedAudio(params, base::MakeUnique<std::string>(str), | 84 muxer.OnEncodedAudio(params, base::MakeUnique<std::string>(str), |
84 base::TimeTicks()); | 85 base::TimeTicks()); |
85 base::RunLoop run_loop; | 86 base::RunLoop run_loop; |
86 run_loop.RunUntilIdle(); | 87 run_loop.RunUntilIdle(); |
87 } | 88 } |
88 } while (num_iterations--); | 89 } while (num_iterations--); |
89 } | 90 } |
90 | 91 |
91 return 0; | 92 return 0; |
92 } | 93 } |
OLD | NEW |