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

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

Issue 647553003: Removes MediaDecoderJob virtual method call from destructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« 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 30 matching lines...) Expand all
41 is_requesting_demuxer_data_(false), 41 is_requesting_demuxer_data_(false),
42 is_incoming_data_invalid_(false), 42 is_incoming_data_invalid_(false),
43 release_resources_pending_(false), 43 release_resources_pending_(false),
44 drm_bridge_(NULL), 44 drm_bridge_(NULL),
45 drain_decoder_(false) { 45 drain_decoder_(false) {
46 InitializeReceivedData(); 46 InitializeReceivedData();
47 eos_unit_.end_of_stream = true; 47 eos_unit_.end_of_stream = true;
48 } 48 }
49 49
50 MediaDecoderJob::~MediaDecoderJob() { 50 MediaDecoderJob::~MediaDecoderJob() {
51 ReleaseMediaCodecBridge(); 51 DCHECK(!media_codec_bridge_);
52 } 52 }
53 53
54 void MediaDecoderJob::OnDataReceived(const DemuxerData& data) { 54 void MediaDecoderJob::OnDataReceived(const DemuxerData& data) {
55 DVLOG(1) << __FUNCTION__ << ": " << data.access_units.size() << " units"; 55 DVLOG(1) << __FUNCTION__ << ": " << data.access_units.size() << " units";
56 DCHECK(ui_task_runner_->BelongsToCurrentThread()); 56 DCHECK(ui_task_runner_->BelongsToCurrentThread());
57 DCHECK(NoAccessUnitsRemainingInChunk(false)); 57 DCHECK(NoAccessUnitsRemainingInChunk(false));
58 58
59 TRACE_EVENT_ASYNC_END2( 59 TRACE_EVENT_ASYNC_END2(
60 "media", "MediaDecoderJob::RequestData", this, 60 "media", "MediaDecoderJob::RequestData", this,
61 "Data type", data.type == media::DemuxerStream::AUDIO ? "AUDIO" : "VIDEO", 61 "Data type", data.type == media::DemuxerStream::AUDIO ? "AUDIO" : "VIDEO",
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 request_data_cb_.Reset(); 227 request_data_cb_.Reset();
228 data_received_cb_.Reset(); 228 data_received_cb_.Reset();
229 decode_cb_.Reset(); 229 decode_cb_.Reset();
230 230
231 if (destroy_pending_) { 231 if (destroy_pending_) {
232 DVLOG(1) << __FUNCTION__ << " : delete is pending decode completion"; 232 DVLOG(1) << __FUNCTION__ << " : delete is pending decode completion";
233 return; 233 return;
234 } 234 }
235 235
236 ReleaseMediaCodecBridge();
236 delete this; 237 delete this;
237 } 238 }
238 239
239 MediaCodecStatus MediaDecoderJob::QueueInputBuffer(const AccessUnit& unit) { 240 MediaCodecStatus MediaDecoderJob::QueueInputBuffer(const AccessUnit& unit) {
240 DVLOG(1) << __FUNCTION__; 241 DVLOG(1) << __FUNCTION__;
241 DCHECK(decoder_task_runner_->BelongsToCurrentThread()); 242 DCHECK(decoder_task_runner_->BelongsToCurrentThread());
242 TRACE_EVENT0("media", __FUNCTION__); 243 TRACE_EVENT0("media", __FUNCTION__);
243 244
244 int input_buf_index = input_buf_index_; 245 int input_buf_index = input_buf_index_;
245 input_buf_index_ = -1; 246 input_buf_index_ = -1;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 completion_callback); 495 completion_callback);
495 } 496 }
496 497
497 void MediaDecoderJob::OnDecodeCompleted( 498 void MediaDecoderJob::OnDecodeCompleted(
498 MediaCodecStatus status, base::TimeDelta current_presentation_timestamp, 499 MediaCodecStatus status, base::TimeDelta current_presentation_timestamp,
499 base::TimeDelta max_presentation_timestamp) { 500 base::TimeDelta max_presentation_timestamp) {
500 DCHECK(ui_task_runner_->BelongsToCurrentThread()); 501 DCHECK(ui_task_runner_->BelongsToCurrentThread());
501 502
502 if (destroy_pending_) { 503 if (destroy_pending_) {
503 DVLOG(1) << __FUNCTION__ << " : completing pending deletion"; 504 DVLOG(1) << __FUNCTION__ << " : completing pending deletion";
505 ReleaseMediaCodecBridge();
504 delete this; 506 delete this;
505 return; 507 return;
506 } 508 }
507 509
508 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM) 510 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM)
509 output_eos_encountered_ = true; 511 output_eos_encountered_ = true;
510 512
511 DCHECK(!decode_cb_.is_null()); 513 DCHECK(!decode_cb_.is_null());
512 514
513 // If output was queued for rendering, then we have completed prerolling. 515 // If output was queued for rendering, then we have completed prerolling.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 646
645 void MediaDecoderJob::ReleaseMediaCodecBridge() { 647 void MediaDecoderJob::ReleaseMediaCodecBridge() {
646 if (!media_codec_bridge_) 648 if (!media_codec_bridge_)
647 return; 649 return;
648 650
649 media_codec_bridge_.reset(); 651 media_codec_bridge_.reset();
650 input_buf_index_ = -1; 652 input_buf_index_ = -1;
651 } 653 }
652 654
653 } // namespace media 655 } // 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