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

Side by Side Diff: trunk/src/media/formats/mpeg/mpeg_audio_stream_parser_base.cc

Issue 242203006: Revert 264763 "Wire up codec_delay() to MP3StreamParser and FFmp..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
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/mpeg/mpeg_audio_stream_parser_base.h" 5 #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "media/base/buffers.h" 10 #include "media/base/buffers.h"
(...skipping 26 matching lines...) Expand all
37 was_lf = true; 37 was_lf = true;
38 } else if (c != '\r' || last_c != '\n') { 38 } else if (c != '\r' || last_c != '\n') {
39 was_lf = false; 39 was_lf = false;
40 } 40 }
41 last_c = c; 41 last_c = c;
42 } 42 }
43 return -1; 43 return -1;
44 } 44 }
45 45
46 MPEGAudioStreamParserBase::MPEGAudioStreamParserBase(uint32 start_code_mask, 46 MPEGAudioStreamParserBase::MPEGAudioStreamParserBase(uint32 start_code_mask,
47 AudioCodec audio_codec, 47 AudioCodec audio_codec)
48 int codec_delay)
49 : state_(UNINITIALIZED), 48 : state_(UNINITIALIZED),
50 in_media_segment_(false), 49 in_media_segment_(false),
51 start_code_mask_(start_code_mask), 50 start_code_mask_(start_code_mask),
52 audio_codec_(audio_codec), 51 audio_codec_(audio_codec) {}
53 codec_delay_(codec_delay) {}
54 52
55 MPEGAudioStreamParserBase::~MPEGAudioStreamParserBase() {} 53 MPEGAudioStreamParserBase::~MPEGAudioStreamParserBase() {}
56 54
57 void MPEGAudioStreamParserBase::Init(const InitCB& init_cb, 55 void MPEGAudioStreamParserBase::Init(const InitCB& init_cb,
58 const NewConfigCB& config_cb, 56 const NewConfigCB& config_cb,
59 const NewBuffersCB& new_buffers_cb, 57 const NewBuffersCB& new_buffers_cb,
60 bool ignore_text_tracks, 58 bool ignore_text_tracks,
61 const NeedKeyCB& need_key_cb, 59 const NeedKeyCB& need_key_cb,
62 const NewMediaSegmentCB& new_segment_cb, 60 const NewMediaSegmentCB& new_segment_cb,
63 const base::Closure& end_of_segment_cb, 61 const base::Closure& end_of_segment_cb,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 config_.channel_layout() != channel_layout)) { 192 config_.channel_layout() != channel_layout)) {
195 // Clear config data so that a config change is initiated. 193 // Clear config data so that a config change is initiated.
196 config_ = AudioDecoderConfig(); 194 config_ = AudioDecoderConfig();
197 195
198 // Send all buffers associated with the previous config. 196 // Send all buffers associated with the previous config.
199 if (!buffers->empty() && !SendBuffers(buffers, true)) 197 if (!buffers->empty() && !SendBuffers(buffers, true))
200 return -1; 198 return -1;
201 } 199 }
202 200
203 if (!config_.IsValidConfig()) { 201 if (!config_.IsValidConfig()) {
204 config_.Initialize(audio_codec_, 202 config_.Initialize(audio_codec_, kSampleFormatF32, channel_layout,
205 kSampleFormatF32, 203 sample_rate, NULL, 0, false, false,
206 channel_layout, 204 base::TimeDelta(), base::TimeDelta());
207 sample_rate,
208 NULL,
209 0,
210 false,
211 false,
212 base::TimeDelta(),
213 codec_delay_);
214 205
215 base::TimeDelta base_timestamp; 206 base::TimeDelta base_timestamp;
216 if (timestamp_helper_) 207 if (timestamp_helper_)
217 base_timestamp = timestamp_helper_->GetTimestamp(); 208 base_timestamp = timestamp_helper_->GetTimestamp();
218 209
219 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); 210 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate));
220 timestamp_helper_->SetBaseTimestamp(base_timestamp); 211 timestamp_helper_->SetBaseTimestamp(base_timestamp);
221 212
222 VideoDecoderConfig video_config; 213 VideoDecoderConfig video_config;
223 bool success = config_cb_.Run(config_, video_config, TextTrackConfigMap()); 214 bool success = config_cb_.Run(config_, video_config, TextTrackConfigMap());
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 if (end_of_segment) { 401 if (end_of_segment) {
411 in_media_segment_ = false; 402 in_media_segment_ = false;
412 end_of_segment_cb_.Run(); 403 end_of_segment_cb_.Run();
413 } 404 }
414 405
415 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); 406 timestamp_helper_->SetBaseTimestamp(base::TimeDelta());
416 return true; 407 return true;
417 } 408 }
418 409
419 } // namespace media 410 } // namespace media
OLDNEW
« no previous file with comments | « trunk/src/media/formats/mpeg/mpeg_audio_stream_parser_base.h ('k') | trunk/src/media/formats/webm/webm_audio_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698