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

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

Issue 227523005: Fix the flaky MediaSourcePlayerTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the comments 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 | « no previous file | 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 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 is_requesting_demuxer_data_ = false; 65 is_requesting_demuxer_data_ = false;
66 return; 66 return;
67 } 67 }
68 68
69 size_t next_demuxer_data_index = inactive_demuxer_data_index(); 69 size_t next_demuxer_data_index = inactive_demuxer_data_index();
70 received_data_[next_demuxer_data_index] = data; 70 received_data_[next_demuxer_data_index] = data;
71 access_unit_index_[next_demuxer_data_index] = 0; 71 access_unit_index_[next_demuxer_data_index] = 0;
72 is_requesting_demuxer_data_ = false; 72 is_requesting_demuxer_data_ = false;
73 73
74 base::Closure done_cb = base::ResetAndReturn(&on_data_received_cb_); 74 base::Closure done_cb = base::ResetAndReturn(&on_data_received_cb_);
75
76 // If this data request is for the inactive chunk, or |on_data_received_cb_|
77 // was set to null by ClearData() or Release(), do nothing.
78 if (done_cb.is_null())
79 return;
80
75 if (stop_decode_pending_) { 81 if (stop_decode_pending_) {
82 DCHECK(is_decoding());
76 OnDecodeCompleted(MEDIA_CODEC_STOPPED, kNoTimestamp(), 0); 83 OnDecodeCompleted(MEDIA_CODEC_STOPPED, kNoTimestamp(), 0);
77 return; 84 return;
78 } 85 }
79 86
80 if (!done_cb.is_null()) 87 done_cb.Run();
81 done_cb.Run();
82 } 88 }
83 89
84 void MediaDecoderJob::Prefetch(const base::Closure& prefetch_cb) { 90 void MediaDecoderJob::Prefetch(const base::Closure& prefetch_cb) {
85 DCHECK(ui_task_runner_->BelongsToCurrentThread()); 91 DCHECK(ui_task_runner_->BelongsToCurrentThread());
86 DCHECK(on_data_received_cb_.is_null()); 92 DCHECK(on_data_received_cb_.is_null());
87 DCHECK(decode_cb_.is_null()); 93 DCHECK(decode_cb_.is_null());
88 94
89 if (HasData()) { 95 if (HasData()) {
90 DVLOG(1) << __FUNCTION__ << " : using previously received data"; 96 DVLOG(1) << __FUNCTION__ << " : using previously received data";
91 ui_task_runner_->PostTask(FROM_HERE, prefetch_cb); 97 ui_task_runner_->PostTask(FROM_HERE, prefetch_cb);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 501 }
496 502
497 void MediaDecoderJob::InitializeReceivedData() { 503 void MediaDecoderJob::InitializeReceivedData() {
498 for (size_t i = 0; i < 2; ++i) { 504 for (size_t i = 0; i < 2; ++i) {
499 received_data_[i] = DemuxerData(); 505 received_data_[i] = DemuxerData();
500 access_unit_index_[i] = 0; 506 access_unit_index_[i] = 0;
501 } 507 }
502 } 508 }
503 509
504 } // namespace media 510 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698