Advertisement
Guest User

Untitled

a guest
Aug 11th, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 12.12 KB | None | 0 0
  1. diff --git a/media/base/audio_buffer_converter.cc b/media/base/audio_buffer_converter.cc
  2. index 59c6681..5d231db 100644
  3. --- a/media/base/audio_buffer_converter.cc
  4. +++ b/media/base/audio_buffer_converter.cc
  5. @@ -17,6 +17,10 @@
  6.  
  7.  namespace media {
  8.  
  9. +
  10. +static base::TimeDelta duration_in;
  11. +static base::TimeDelta duration_out;
  12. +
  13.  // Is the config presented by |buffer| a config change from |params|?
  14.  static bool IsConfigChange(const AudioParameters& params,
  15.                             const scoped_refptr<AudioBuffer>& buffer) {
  16. @@ -45,6 +49,8 @@ void AudioBufferConverter::AddInput(const scoped_refptr<AudioBuffer>& buffer) {
  17.      return;
  18.    }
  19.  
  20. +  duration_in += buffer->duration();
  21. +
  22.    // We'll need a new |audio_converter_| if there was a config change.
  23.    if (IsConfigChange(input_params_, buffer))
  24.      ResetConverter(buffer);
  25. @@ -70,10 +76,14 @@ scoped_refptr<AudioBuffer> AudioBufferConverter::GetNextBuffer() {
  26.    DCHECK(!queued_outputs_.empty());
  27.    scoped_refptr<AudioBuffer> out = queued_outputs_.front();
  28.    queued_outputs_.pop_front();
  29. +  duration_out += out->duration();
  30.    return out;
  31.  }
  32.  
  33.  void AudioBufferConverter::Reset() {
  34. +  LOG(ERROR) << "in: " << duration_in.InMicroseconds()
  35. +             << ", out: " << duration_out.InMicroseconds();
  36. +  duration_out = duration_in = base::TimeDelta();
  37.    audio_converter_.reset();
  38.    queued_inputs_.clear();
  39.    queued_outputs_.clear();
  40. diff --git a/media/base/audio_converter.cc b/media/base/audio_converter.cc
  41. index aa0be4f..b51d274 100644
  42. --- a/media/base/audio_converter.cc
  43. +++ b/media/base/audio_converter.cc
  44. @@ -34,7 +34,7 @@ AudioConverter::AudioConverter(const AudioParameters& input_params,
  45.  
  46.    // Handle different input and output channel layouts.
  47.    if (input_params.channel_layout() != output_params.channel_layout()) {
  48. -    DVLOG(1) << "Remixing channel layout from " << input_params.channel_layout()
  49. +    LOG(ERROR) << "Remixing channel layout from " << input_params.channel_layout()
  50.               << " to " << output_params.channel_layout() << "; from "
  51.               << input_params.channels() << " channels to "
  52.               << output_params.channels() << " channels.";
  53. @@ -46,7 +46,7 @@ AudioConverter::AudioConverter(const AudioParameters& input_params,
  54.  
  55.    // Only resample if necessary since it's expensive.
  56.    if (input_params.sample_rate() != output_params.sample_rate()) {
  57. -    DVLOG(1) << "Resampling from " << input_params.sample_rate() << " to "
  58. +    LOG(ERROR) << "Resampling from " << input_params.sample_rate() << " to "
  59.               << output_params.sample_rate();
  60.      const int request_size = disable_fifo ? SincResampler::kDefaultRequestSize :
  61.          input_params.frames_per_buffer();
  62. @@ -76,7 +76,7 @@ AudioConverter::AudioConverter(const AudioParameters& input_params,
  63.    // asked for, we need to use a FIFO to ensure that both sides read in chunk
  64.    // sizes they're configured for.
  65.    if (input_params.frames_per_buffer() != output_params.frames_per_buffer()) {
  66. -    DVLOG(1) << "Rebuffering from " << input_params.frames_per_buffer()
  67. +    LOG(ERROR) << "Rebuffering from " << input_params.frames_per_buffer()
  68.               << " to " << output_params.frames_per_buffer();
  69.      chunk_size_ = input_params.frames_per_buffer();
  70.      audio_fifo_.reset(new AudioPullFifo(
  71. diff --git a/media/base/audio_discard_helper.cc b/media/base/audio_discard_helper.cc
  72. index 303ee79..fccfa9b 100644
  73. --- a/media/base/audio_discard_helper.cc
  74. +++ b/media/base/audio_discard_helper.cc
  75. @@ -64,6 +64,7 @@ bool AudioDiscardHelper::ProcessBuffers(
  76.    // If this is the first buffer seen, setup the timestamp helper.
  77.    const bool first_buffer = !initialized();
  78.    if (first_buffer) {
  79. +    LOG(ERROR) << "Reseting time state to " << encoded_buffer->timestamp().InMicroseconds();
  80.      // Clamp the base timestamp to zero.
  81.      timestamp_helper_.SetBaseTimestamp(
  82.          std::max(base::TimeDelta(), encoded_buffer->timestamp()));
  83. @@ -191,8 +192,19 @@ bool AudioDiscardHelper::ProcessBuffers(
  84.    }
  85.  
  86.    // Assign timestamp to the buffer.
  87. +  if (decoded_buffer->duration() != encoded_buffer->duration()) {
  88. +    LOG(ERROR) << "Duration mismatch: "
  89. +               << encoded_buffer->duration().InMicroseconds() << " vs "
  90. +               << decoded_buffer->duration().InMicroseconds() << ".  Delta: "
  91. +               << std::abs((decoded_buffer->duration() -
  92. +                            encoded_buffer->duration()).InMicroseconds());
  93. +  }
  94. +
  95.    decoded_buffer->set_timestamp(timestamp_helper_.GetTimestamp());
  96.    timestamp_helper_.AddFrames(decoded_buffer->frame_count());
  97. +
  98. +  LOG(ERROR) << encoded_buffer->timestamp().InMicroseconds() << " -> "
  99. +             << decoded_buffer->timestamp().InMicroseconds();
  100.    return true;
  101.  }
  102.  
  103. diff --git a/media/base/audio_splicer.cc b/media/base/audio_splicer.cc
  104. index 7fafc8b..4bb53b1 100644
  105. --- a/media/base/audio_splicer.cc
  106. +++ b/media/base/audio_splicer.cc
  107. @@ -128,7 +128,7 @@ bool AudioStreamSanitizer::AddInput(const scoped_refptr<AudioBuffer>& input) {
  108.      output_timestamp_helper_.SetBaseTimestamp(input->timestamp());
  109.  
  110.    if (output_timestamp_helper_.base_timestamp() > input->timestamp()) {
  111. -    DVLOG(1) << "Input timestamp is before the base timestamp.";
  112. +    LOG(ERROR) << "Input timestamp is before the base timestamp.";
  113.      return false;
  114.    }
  115.  
  116. @@ -139,7 +139,7 @@ bool AudioStreamSanitizer::AddInput(const scoped_refptr<AudioBuffer>& input) {
  117.  
  118.    if (std::abs(delta.InMilliseconds()) >
  119.        AudioSplicer::kMaxTimeDeltaInMilliseconds) {
  120. -    DVLOG(1) << "Timestamp delta too large: " << delta.InMicroseconds() << "us";
  121. +    LOG(ERROR) << "Timestamp delta too large: " << delta.InMicroseconds() << "us";
  122.      return false;
  123.    }
  124.  
  125. @@ -153,7 +153,7 @@ bool AudioStreamSanitizer::AddInput(const scoped_refptr<AudioBuffer>& input) {
  126.    }
  127.  
  128.    if (frames_to_fill > 0) {
  129. -    DVLOG(1) << "Gap detected @ " << expected_timestamp.InMicroseconds()
  130. +    LOG(ERROR) << "Gap detected @ " << expected_timestamp.InMicroseconds()
  131.               << " us: " << delta.InMicroseconds() << " us";
  132.  
  133.      // Create a buffer with enough silence samples to fill the gap and
  134. @@ -177,12 +177,12 @@ bool AudioStreamSanitizer::AddInput(const scoped_refptr<AudioBuffer>& input) {
  135.    //
  136.    // A crossfade can't be done here because only the current buffer is available
  137.    // at this point, not previous buffers.
  138. -  DVLOG(1) << "Overlap detected @ " << expected_timestamp.InMicroseconds()
  139. +  LOG(ERROR) << "Overlap detected @ " << expected_timestamp.InMicroseconds()
  140.             << " us: " << -delta.InMicroseconds() << " us";
  141.  
  142.    const int frames_to_skip = -frames_to_fill;
  143.    if (input->frame_count() <= frames_to_skip) {
  144. -    DVLOG(1) << "Dropping whole buffer";
  145. +    LOG(ERROR) << "Dropping whole buffer";
  146.      return true;
  147.    }
  148.  
  149. @@ -267,6 +267,10 @@ bool AudioSplicer::AddInput(const scoped_refptr<AudioBuffer>& input) {
  150.      // added to the output queue.
  151.      if (input->timestamp() + input->duration() < splice_timestamp_) {
  152.        DCHECK(!pre_splice_sanitizer_->HasNextBuffer());
  153. +    LOG(ERROR) << "Skipping pre splice: [" << input->timestamp().InMicroseconds()
  154. +               << ", "
  155. +               << (input->timestamp() + input->duration()).InMicroseconds()
  156. +               << "]";
  157.        return output_sanitizer_->AddInput(input);
  158.      }
  159.  
  160. @@ -279,6 +283,10 @@ bool AudioSplicer::AddInput(const scoped_refptr<AudioBuffer>& input) {
  161.            output_ts_helper.frame_count(), output_ts_helper.base_timestamp());
  162.      }
  163.  
  164. +    LOG(ERROR) << "Add pre splice: [" << input->timestamp().InMicroseconds()
  165. +               << ", "
  166. +               << (input->timestamp() + input->duration()).InMicroseconds()
  167. +               << "]";
  168.      return pre_splice_sanitizer_->AddInput(input);
  169.    }
  170.  
  171. @@ -289,8 +297,14 @@ bool AudioSplicer::AddInput(const scoped_refptr<AudioBuffer>& input) {
  172.    // At this point we have all the fade out preroll buffers from the decoder.
  173.    // We now need to wait until we have enough data to perform the crossfade (or
  174.    // we receive an end of stream).
  175. -  if (!post_splice_sanitizer_->AddInput(input))
  176. +  if (!post_splice_sanitizer_->AddInput(input)) {
  177.      return false;
  178. +  } else {
  179. +    LOG(ERROR) << "Add post splice: [" << input->timestamp().InMicroseconds()
  180. +               << ", "
  181. +               << (input->timestamp() + input->duration()).InMicroseconds()
  182. +               << "]";
  183. +  }
  184.  
  185.    // Ensure |output_sanitizer_| has a valid base timestamp so we can use it for
  186.    // timestamp calculations.
  187. @@ -304,6 +318,18 @@ bool AudioSplicer::AddInput(const scoped_refptr<AudioBuffer>& input) {
  188.    // the splice.  In this case, just transfer all data to the output sanitizer.
  189.    if (pre_splice_sanitizer_->GetFrameCount() <=
  190.        output_ts_helper.GetFramesToTarget(splice_timestamp_)) {
  191. +    LOG(ERROR) << "Aborting false splice @ "
  192. +               << splice_timestamp_.InMicroseconds() << ", NextPre: "
  193. +               << (pre_splice_sanitizer_->HasNextBuffer()
  194. +                       ? pre_splice_sanitizer_->timestamp_helper()
  195. +                             .GetTimestamp()
  196. +                             .InMicroseconds()
  197. +                       : -1) << ", FirstPost: "
  198. +               << (post_splice_sanitizer_->HasNextBuffer()
  199. +                       ? post_splice_sanitizer_->timestamp_helper()
  200. +                             .base_timestamp()
  201. +                             .InMicroseconds()
  202. +                       : -1);
  203.      CHECK(pre_splice_sanitizer_->DrainInto(output_sanitizer_.get()));
  204.  
  205.      // If the file contains incorrectly muxed timestamps, there may be huge gaps
  206. diff --git a/media/filters/audio_renderer_impl.cc b/media/filters/audio_renderer_impl.cc
  207. index 144e054..f18ae03 100644
  208. --- a/media/filters/audio_renderer_impl.cc
  209. +++ b/media/filters/audio_renderer_impl.cc
  210. @@ -682,6 +682,7 @@ void AudioRendererImpl::OnConfigChange() {
  211.    // only appear after config changes, AddInput() should never fail here.
  212.    while (buffer_converter_->HasNextBuffer())
  213.      CHECK(splicer_->AddInput(buffer_converter_->GetNextBuffer()));
  214. +  buffer_converter_->Reset();
  215.  }
  216.  
  217.  void AudioRendererImpl::SetBufferingState_Locked(
  218. diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc
  219. index 8bc65854..707af04 100644
  220. --- a/media/filters/source_buffer_stream.cc
  221. +++ b/media/filters/source_buffer_stream.cc
  222. @@ -1697,6 +1697,14 @@ void SourceBufferStream::GenerateSpliceFrame(const BufferQueue& new_buffers) {
  223.      return;
  224.    }
  225.  
  226. +  const base::TimeDelta end_ts = pre_splice_buffers.front()->timestamp() +
  227. +                                 pre_splice_buffers.front()->duration();
  228. +  LOG(ERROR) << "Generating splice frame @ "
  229. +             << splice_timestamp.InMicroseconds() << "ms. Overlaps range ["
  230. +             << pre_splice_buffers.front()->timestamp().InMicroseconds()
  231. +             << ", " << end_ts.InMicroseconds() << "] by "
  232. +             << (end_ts - splice_timestamp).InMicroseconds() << "ms";
  233. +
  234.    new_buffers.front()->ConvertToSpliceBuffer(pre_splice_buffers);
  235.  }
  236.  
  237. diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc
  238. index 8ec925c..4f993eb 100644
  239. --- a/media/formats/mp4/mp4_stream_parser.cc
  240. +++ b/media/formats/mp4/mp4_stream_parser.cc
  241. @@ -270,6 +270,7 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
  242.            is_audio_track_encrypted_, false, base::TimeDelta(),
  243.            0);
  244.        has_audio_ = true;
  245. +      LOG(ERROR) << "MP4 Parsing Audio";
  246.        audio_track_id_ = track->header.track_id;
  247.      }
  248.      if (track->media.handler.type == kVideo && !video_config.IsValidConfig()) {
  249. diff --git a/media/formats/webm/webm_stream_parser.cc b/media/formats/webm/webm_stream_parser.cc
  250. index dd200d2..ea59454 100644
  251. --- a/media/formats/webm/webm_stream_parser.cc
  252. +++ b/media/formats/webm/webm_stream_parser.cc
  253. @@ -220,6 +220,10 @@ int WebMStreamParser::ParseInfoAndTracks(const uint8* data, int size) {
  254.    if (video_config.is_encrypted())
  255.      FireNeedKey(tracks_parser.video_encryption_key_id());
  256.  
  257. +  if (audio_config.IsValidConfig()) {
  258. +    LOG(ERROR) << "WebM parsing audio...";
  259. +  }
  260. +
  261.    if (!config_cb_.Run(audio_config,
  262.                        video_config,
  263.                        tracks_parser.text_tracks())) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement