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

Side by Side Diff: media/muxers/webm_muxer_fuzzertest.cc

Issue 2612403002: Release video frames earlier in MediaRecorder (Closed)
Patch Set: mcasas@ nits. Created 3 years, 11 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/muxers/webm_muxer.cc ('k') | media/muxers/webm_muxer_unittest.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 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
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 }
OLDNEW
« no previous file with comments | « media/muxers/webm_muxer.cc ('k') | media/muxers/webm_muxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698