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

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 10669022: Add status parameter to DemuxerStream::ReadCB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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 | « media/filters/gpu_video_decoder.h ('k') | media/tools/player_x11/player_x11.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.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.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 EnsureDemuxOrDecode(); 203 EnsureDemuxOrDecode();
204 break; 204 break;
205 case kDrainingDecoder: 205 case kDrainingDecoder:
206 // Do nothing. Will be satisfied either by a PictureReady or 206 // Do nothing. Will be satisfied either by a PictureReady or
207 // NotifyFlushDone below. 207 // NotifyFlushDone below.
208 break; 208 break;
209 } 209 }
210 } 210 }
211 211
212 void GpuVideoDecoder::RequestBufferDecode( 212 void GpuVideoDecoder::RequestBufferDecode(
213 DemuxerStream::Status status,
213 const scoped_refptr<DecoderBuffer>& buffer) { 214 const scoped_refptr<DecoderBuffer>& buffer) {
215 DCHECK_EQ(status != DemuxerStream::kOk, !buffer) << status;
216
214 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { 217 if (!gvd_loop_proxy_->BelongsToCurrentThread()) {
215 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( 218 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind(
216 &GpuVideoDecoder::RequestBufferDecode, this, buffer)); 219 &GpuVideoDecoder::RequestBufferDecode, this, status, buffer));
217 return; 220 return;
218 } 221 }
219 demuxer_read_in_progress_ = false; 222 demuxer_read_in_progress_ = false;
220 223
221 if (!buffer) { 224 if (status != DemuxerStream::kOk) {
222 if (pending_read_cb_.is_null()) 225 if (pending_read_cb_.is_null())
223 return; 226 return;
224 227
228 // TODO(acolwell): Add support for reinitializing the decoder when
229 // |status| == kConfigChanged. For now we just trigger a decode error.
230 DecoderStatus decoder_status =
231 (status == DemuxerStream::kAborted) ? kOk : kDecodeError;
225 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( 232 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind(
226 pending_read_cb_, kOk, scoped_refptr<VideoFrame>())); 233 pending_read_cb_, decoder_status, scoped_refptr<VideoFrame>()));
227 pending_read_cb_.Reset(); 234 pending_read_cb_.Reset();
228 return; 235 return;
229 } 236 }
230 237
231 if (!vda_.get()) { 238 if (!vda_.get()) {
232 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); 239 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame());
233 return; 240 return;
234 } 241 }
235 242
236 if (buffer->IsEndOfStream()) { 243 if (buffer->IsEndOfStream()) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 558
552 error_occured_ = true; 559 error_occured_ = true;
553 560
554 if (!pending_read_cb_.is_null()) { 561 if (!pending_read_cb_.is_null()) {
555 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); 562 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL);
556 return; 563 return;
557 } 564 }
558 } 565 }
559 566
560 } // namespace media 567 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/tools/player_x11/player_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698