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

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

Issue 123213006: Make VideoDecoder use (kAborted, NULL) to signify an aborted decode, instead of (kOk, NULL). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle aborted read status in VideoFrameStream. 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/filters/video_frame_stream.h" 5 #include "media/filters/video_frame_stream.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/location.h" 10 #include "base/location.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 Decode(DecoderBuffer::CreateEOSBuffer()); 238 Decode(DecoderBuffer::CreateEOSBuffer());
239 } 239 }
240 240
241 void VideoFrameStream::OnFrameReady(int buffer_size, 241 void VideoFrameStream::OnFrameReady(int buffer_size,
242 const VideoDecoder::Status status, 242 const VideoDecoder::Status status,
243 const scoped_refptr<VideoFrame>& frame) { 243 const scoped_refptr<VideoFrame>& frame) {
244 DVLOG(2) << __FUNCTION__; 244 DVLOG(2) << __FUNCTION__;
245 DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER) << state_; 245 DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER) << state_;
246 DCHECK(!read_cb_.is_null()); 246 DCHECK(!read_cb_.is_null());
247 DCHECK(stop_cb_.is_null()); 247 DCHECK(stop_cb_.is_null());
248 248
xhwang 2014/01/03 01:05:58 DCHECK_EQ(status == VideoDecoder::kOk, frame != NU
249 TRACE_EVENT_ASYNC_END0("media", "VideoFrameStream::Decode", this); 249 TRACE_EVENT_ASYNC_END0("media", "VideoFrameStream::Decode", this);
250 250
251 if (status == VideoDecoder::kDecodeError) { 251 if (status == VideoDecoder::kDecodeError) {
252 DCHECK(!frame.get()); 252 DCHECK(!frame.get());
253 state_ = STATE_ERROR; 253 state_ = STATE_ERROR;
254 SatisfyRead(DECODE_ERROR, NULL); 254 SatisfyRead(DECODE_ERROR, NULL);
255 return; 255 return;
256 } 256 }
257 257
258 if (status == VideoDecoder::kDecryptError) { 258 if (status == VideoDecoder::kDecryptError) {
259 DCHECK(!frame.get()); 259 DCHECK(!frame.get());
260 state_ = STATE_ERROR; 260 state_ = STATE_ERROR;
261 SatisfyRead(DECRYPT_ERROR, NULL); 261 SatisfyRead(DECRYPT_ERROR, NULL);
262 return; 262 return;
263 } 263 }
264 264
265 if (status == VideoDecoder::kAborted) {
266 DCHECK(!frame.get());
267 AbortRead();
268 return;
269 }
xhwang 2014/01/03 01:05:58 VideoDecoder::kAborted can only be a result of a p
270
265 // Any successful decode counts! 271 // Any successful decode counts!
266 if (buffer_size > 0) { 272 if (buffer_size > 0) {
267 PipelineStatistics statistics; 273 PipelineStatistics statistics;
268 statistics.video_bytes_decoded = buffer_size; 274 statistics.video_bytes_decoded = buffer_size;
269 statistics_cb_.Run(statistics); 275 statistics_cb_.Run(statistics);
270 } 276 }
271 277
272 // Drop decoding result if Reset() was called during decoding. 278 // Drop decoding result if Reset() was called during decoding.
273 // The resetting process will be handled when the decoder is reset. 279 // The resetting process will be handled when the decoder is reset.
274 if (!reset_cb_.is_null()) { 280 if (!reset_cb_.is_null()) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 DCHECK(!stop_cb_.is_null()); 452 DCHECK(!stop_cb_.is_null());
447 453
448 state_ = STATE_STOPPED; 454 state_ = STATE_STOPPED;
449 stream_ = NULL; 455 stream_ = NULL;
450 decoder_.reset(); 456 decoder_.reset();
451 decrypting_demuxer_stream_.reset(); 457 decrypting_demuxer_stream_.reset();
452 base::ResetAndReturn(&stop_cb_).Run(); 458 base::ResetAndReturn(&stop_cb_).Run();
453 } 459 }
454 460
455 } // namespace media 461 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698