| Index: content/renderer/media/media_recorder_handler_unittest.cc
|
| diff --git a/content/renderer/media/media_recorder_handler_unittest.cc b/content/renderer/media/media_recorder_handler_unittest.cc
|
| index 4a92b223b26d5d55755dd62eeadb3999f94916b6..0769a263b2ec746e2358e28fbd3a5c18682f5606 100644
|
| --- a/content/renderer/media/media_recorder_handler_unittest.cc
|
| +++ b/content/renderer/media/media_recorder_handler_unittest.cc
|
| @@ -41,7 +41,11 @@ static const std::string kTestAudioTrackId = "audio_track_id";
|
| static const int kTestAudioChannels = 2;
|
| static const int kTestAudioBitsPerSample = 16;
|
| static const int kTestAudioSampleRate = 48000;
|
| -static const int kTestAudioBufferDurationMS = 60;
|
| +// MediaStream Audio Track always provides audio in chunks of 10 ms.
|
| +static const int kMediaStreamAudioTrackBufferDurationMs = 10;
|
| +// Opus works with 60ms buffers, so 6 MediaStreamAudioTrack Buffers are needed
|
| +// to encode one output buffer.
|
| +static const int kRatioOpusToMediaStreamTrackBuffers = 6;
|
|
|
| struct MediaRecorderTestParams {
|
| const bool has_video;
|
| @@ -59,7 +63,7 @@ struct MediaRecorderTestParams {
|
| static const MediaRecorderTestParams kMediaRecorderTestParams[] = {
|
| {true, false, "video/webm", "vp8", 52, 32, 0, 0},
|
| {true, false, "video/webm", "vp9", 33, 18, 0, 0},
|
| - {false, true, "video/webm", "vp8", 0, 0, 990, 706}};
|
| + {false, true, "video/webm", "vp8", 0, 0, 996, 746}};
|
|
|
| class MediaRecorderHandlerTest : public TestWithParam<MediaRecorderTestParams>,
|
| public blink::WebMediaRecorderHandlerClient {
|
| @@ -113,7 +117,7 @@ class MediaRecorderHandlerTest : public TestWithParam<MediaRecorderTestParams>,
|
| scoped_ptr<media::AudioBus> NextAudioBus() {
|
| scoped_ptr<media::AudioBus> bus(media::AudioBus::Create(
|
| kTestAudioChannels,
|
| - kTestAudioSampleRate * kTestAudioBufferDurationMS / 1000));
|
| + kTestAudioSampleRate * kMediaStreamAudioTrackBufferDurationMs / 1000));
|
| audio_source_.OnMoreData(bus.get(), 0, 0);
|
| return bus;
|
| }
|
| @@ -284,7 +288,7 @@ TEST_P(MediaRecorderHandlerTest, EncodeAudioFrames) {
|
| media::AudioParameters params(
|
| media::AudioParameters::AUDIO_PCM_LINEAR, media::CHANNEL_LAYOUT_STEREO,
|
| kTestAudioSampleRate, kTestAudioBitsPerSample,
|
| - kTestAudioSampleRate * kTestAudioBufferDurationMS / 1000);
|
| + kTestAudioSampleRate * kMediaStreamAudioTrackBufferDurationMs / 1000);
|
| SetAudioFormatForTesting(params);
|
|
|
| {
|
| @@ -298,7 +302,8 @@ TEST_P(MediaRecorderHandlerTest, EncodeAudioFrames) {
|
| .Times(1)
|
| .WillOnce(RunClosure(quit_closure));
|
|
|
| - OnAudioBusForTesting(*audio_bus1);
|
| + for (int i = 0; i < kRatioOpusToMediaStreamTrackBuffers; ++i)
|
| + OnAudioBusForTesting(*audio_bus1);
|
| run_loop.Run();
|
| }
|
|
|
| @@ -315,7 +320,8 @@ TEST_P(MediaRecorderHandlerTest, EncodeAudioFrames) {
|
| .Times(1)
|
| .WillOnce(RunClosure(quit_closure));
|
|
|
| - OnAudioBusForTesting(*audio_bus2);
|
| + for (int i = 0; i < kRatioOpusToMediaStreamTrackBuffers; ++i)
|
| + OnAudioBusForTesting(*audio_bus2);
|
| run_loop.Run();
|
| }
|
|
|
|
|