OLD | NEW |
---|---|
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 EnsureDemuxOrDecode(); | 193 EnsureDemuxOrDecode(); |
194 break; | 194 break; |
195 case kDrainingDecoder: | 195 case kDrainingDecoder: |
196 // Do nothing. Will be satisfied either by a PictureReady or | 196 // Do nothing. Will be satisfied either by a PictureReady or |
197 // NotifyFlushDone below. | 197 // NotifyFlushDone below. |
198 break; | 198 break; |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 void GpuVideoDecoder::RequestBufferDecode( | 202 void GpuVideoDecoder::RequestBufferDecode( |
203 DemuxerStream::Status status, | |
203 const scoped_refptr<DecoderBuffer>& buffer) { | 204 const scoped_refptr<DecoderBuffer>& buffer) { |
205 DCHECK_EQ(status != DemuxerStream::kOk, !buffer); | |
Ami GONE FROM CHROMIUM
2012/07/12 17:10:26
ditto << status
acolwell GONE FROM CHROMIUM
2012/07/12 21:59:58
Done.
| |
206 | |
204 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { | 207 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { |
205 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 208 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
206 &GpuVideoDecoder::RequestBufferDecode, this, buffer)); | 209 &GpuVideoDecoder::RequestBufferDecode, this, status, buffer)); |
207 return; | 210 return; |
208 } | 211 } |
209 demuxer_read_in_progress_ = false; | 212 demuxer_read_in_progress_ = false; |
210 | 213 |
211 if (!buffer) { | 214 if (status != DemuxerStream::kOk) { |
212 if (pending_read_cb_.is_null()) | 215 if (pending_read_cb_.is_null()) |
213 return; | 216 return; |
214 | 217 |
218 // TODO(acolwell): Add support for reinitializing the decoder when | |
219 // |status| == kConfigChanged. For now we just trigger a decode error. | |
220 DecoderStatus decoder_status = | |
221 (status == DemuxerStream::kAborted) ? kOk : kDecodeError; | |
215 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 222 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
216 pending_read_cb_, kOk, scoped_refptr<VideoFrame>())); | 223 pending_read_cb_, decoder_status, scoped_refptr<VideoFrame>())); |
217 pending_read_cb_.Reset(); | 224 pending_read_cb_.Reset(); |
218 return; | 225 return; |
219 } | 226 } |
220 | 227 |
221 if (!vda_) { | 228 if (!vda_) { |
222 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); | 229 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); |
223 return; | 230 return; |
224 } | 231 } |
225 | 232 |
226 if (buffer->IsEndOfStream()) { | 233 if (buffer->IsEndOfStream()) { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 | 546 |
540 error_occured_ = true; | 547 error_occured_ = true; |
541 | 548 |
542 if (!pending_read_cb_.is_null()) { | 549 if (!pending_read_cb_.is_null()) { |
543 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); | 550 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); |
544 return; | 551 return; |
545 } | 552 } |
546 } | 553 } |
547 | 554 |
548 } // namespace media | 555 } // namespace media |
OLD | NEW |