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

Side by Side Diff: media/base/android/media_decoder_job.cc

Issue 113963005: Use decoder's timestamp instead of the timestamp from AU during prerolling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding crbug Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/android/media_source_player_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/base/android/media_decoder_job.h" 5 #include "media/base/android/media_decoder_job.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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 callback.Run(status, kNoTimestamp(), 0); 343 callback.Run(status, kNoTimestamp(), 0);
344 return; 344 return;
345 } 345 }
346 346
347 // TODO(xhwang/qinmin): This logic is correct but strange. Clean it up. 347 // TODO(xhwang/qinmin): This logic is correct but strange. Clean it up.
348 if (output_eos_encountered_) 348 if (output_eos_encountered_)
349 status = MEDIA_CODEC_OUTPUT_END_OF_STREAM; 349 status = MEDIA_CODEC_OUTPUT_END_OF_STREAM;
350 else if (input_status == MEDIA_CODEC_INPUT_END_OF_STREAM) 350 else if (input_status == MEDIA_CODEC_INPUT_END_OF_STREAM)
351 status = MEDIA_CODEC_INPUT_END_OF_STREAM; 351 status = MEDIA_CODEC_INPUT_END_OF_STREAM;
352 352
353 // Check whether we need to render the output. 353 bool render_output = presentation_timestamp >= preroll_timestamp_ &&
354 // TODO(qinmin): comparing most recently queued input's |unit.timestamp| with
355 // |preroll_timestamp_| is not accurate due to data reordering and possible
356 // input queueing without immediate dequeue when |input_status| !=
357 // |MEDIA_CODEC_OK|. Need to use the |presentation_timestamp| for video, and
358 // use |size| to calculate the timestamp for audio. See
359 // http://crbug.com/310823 and http://b/11356652.
360 bool render_output = unit.timestamp >= preroll_timestamp_ &&
361 (status != MEDIA_CODEC_OUTPUT_END_OF_STREAM || size != 0u); 354 (status != MEDIA_CODEC_OUTPUT_END_OF_STREAM || size != 0u);
362 base::TimeDelta time_to_render; 355 base::TimeDelta time_to_render;
363 DCHECK(!start_time_ticks.is_null()); 356 DCHECK(!start_time_ticks.is_null());
364 if (render_output && ComputeTimeToRender()) { 357 if (render_output && ComputeTimeToRender()) {
365 time_to_render = presentation_timestamp - (base::TimeTicks::Now() - 358 time_to_render = presentation_timestamp - (base::TimeTicks::Now() -
366 start_time_ticks + start_presentation_timestamp); 359 start_time_ticks + start_presentation_timestamp);
367 } 360 }
368 361
369 if (time_to_render > base::TimeDelta()) { 362 if (time_to_render > base::TimeDelta()) {
370 decoder_task_runner_->PostDelayedTask( 363 decoder_task_runner_->PostDelayedTask(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // Do nothing. 422 // Do nothing.
430 break; 423 break;
431 }; 424 };
432 425
433 stop_decode_pending_ = false; 426 stop_decode_pending_ = false;
434 base::ResetAndReturn(&decode_cb_).Run(status, presentation_timestamp, 427 base::ResetAndReturn(&decode_cb_).Run(status, presentation_timestamp,
435 audio_output_bytes); 428 audio_output_bytes);
436 } 429 }
437 430
438 } // namespace media 431 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/android/media_source_player_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698