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

Side by Side Diff: media/formats/webm/webm_audio_client.cc

Issue 239423005: Wire up codec_delay() to MP3StreamParser and FFmpegAudioDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ResetTimestampState() on config change. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « media/formats/mpeg/mpeg_audio_stream_parser_base.cc ('k') | no next file » | 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 #include "media/formats/webm/webm_audio_client.h" 5 #include "media/formats/webm/webm_audio_client.h"
6 6
7 #include "media/base/audio_decoder_config.h" 7 #include "media/base/audio_decoder_config.h"
8 #include "media/base/channel_layout.h" 8 #include "media/base/channel_layout.h"
9 #include "media/formats/webm/webm_constants.h" 9 #include "media/formats/webm/webm_constants.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (output_samples_per_second_ > 0) 58 if (output_samples_per_second_ > 0)
59 samples_per_second = output_samples_per_second_; 59 samples_per_second = output_samples_per_second_;
60 60
61 const uint8* extra_data = NULL; 61 const uint8* extra_data = NULL;
62 size_t extra_data_size = 0; 62 size_t extra_data_size = 0;
63 if (codec_private.size() > 0) { 63 if (codec_private.size() > 0) {
64 extra_data = &codec_private[0]; 64 extra_data = &codec_private[0];
65 extra_data_size = codec_private.size(); 65 extra_data_size = codec_private.size();
66 } 66 }
67 67
68 // Convert |codec_delay| from nanoseconds into frames.
69 int codec_delay_in_frames = 0;
70 if (codec_delay != -1) {
71 codec_delay_in_frames =
72 0.5 +
73 samples_per_second * (static_cast<double>(codec_delay) /
74 base::Time::kNanosecondsPerSecond);
75 }
76
68 config->Initialize( 77 config->Initialize(
69 audio_codec, 78 audio_codec,
70 (audio_codec == kCodecOpus) ? kSampleFormatS16 : kSampleFormatPlanarF32, 79 (audio_codec == kCodecOpus) ? kSampleFormatS16 : kSampleFormatPlanarF32,
71 channel_layout, 80 channel_layout,
72 samples_per_second, extra_data, extra_data_size, is_encrypted, true, 81 samples_per_second,
82 extra_data,
83 extra_data_size,
84 is_encrypted,
85 true,
73 base::TimeDelta::FromMicroseconds( 86 base::TimeDelta::FromMicroseconds(
74 (seek_preroll != -1 ? seek_preroll : 0) / 1000), 87 (seek_preroll != -1 ? seek_preroll : 0) / 1000),
75 base::TimeDelta::FromMicroseconds( 88 codec_delay_in_frames);
76 (codec_delay != -1 ? codec_delay : 0) / 1000));
77 return config->IsValidConfig(); 89 return config->IsValidConfig();
78 } 90 }
79 91
80 bool WebMAudioClient::OnUInt(int id, int64 val) { 92 bool WebMAudioClient::OnUInt(int id, int64 val) {
81 if (id == kWebMIdChannels) { 93 if (id == kWebMIdChannels) {
82 if (channels_ != -1) { 94 if (channels_ != -1) {
83 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id 95 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id
84 << " specified. (" << channels_ << " and " << val 96 << " specified. (" << channels_ << " and " << val
85 << ")"; 97 << ")";
86 return false; 98 return false;
(...skipping 25 matching lines...) Expand all
112 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id 124 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id
113 << " specified (" << *dst << " and " << val << ")"; 125 << " specified (" << *dst << " and " << val << ")";
114 return false; 126 return false;
115 } 127 }
116 128
117 *dst = val; 129 *dst = val;
118 return true; 130 return true;
119 } 131 }
120 132
121 } // namespace media 133 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mpeg/mpeg_audio_stream_parser_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698