| OLD | NEW |
| 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 Loading... |
| 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 DCHECK_EQ(status == VideoDecoder::kOk, frame != NULL); |
| 248 | 249 |
| 249 TRACE_EVENT_ASYNC_END0("media", "VideoFrameStream::Decode", this); | 250 TRACE_EVENT_ASYNC_END0("media", "VideoFrameStream::Decode", this); |
| 250 | 251 |
| 251 if (status == VideoDecoder::kDecodeError) { | 252 if (status == VideoDecoder::kDecodeError) { |
| 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()); | |
| 260 state_ = STATE_ERROR; | 259 state_ = STATE_ERROR; |
| 261 SatisfyRead(DECRYPT_ERROR, NULL); | 260 SatisfyRead(DECRYPT_ERROR, NULL); |
| 262 return; | 261 return; |
| 263 } | 262 } |
| 264 | 263 |
| 265 // Any successful decode counts! | 264 // Any successful decode counts! |
| 266 if (buffer_size > 0) { | 265 if (buffer_size > 0) { |
| 267 PipelineStatistics statistics; | 266 PipelineStatistics statistics; |
| 268 statistics.video_bytes_decoded = buffer_size; | 267 statistics.video_bytes_decoded = buffer_size; |
| 269 statistics_cb_.Run(statistics); | 268 statistics_cb_.Run(statistics); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 DCHECK(!stop_cb_.is_null()); | 445 DCHECK(!stop_cb_.is_null()); |
| 447 | 446 |
| 448 state_ = STATE_STOPPED; | 447 state_ = STATE_STOPPED; |
| 449 stream_ = NULL; | 448 stream_ = NULL; |
| 450 decoder_.reset(); | 449 decoder_.reset(); |
| 451 decrypting_demuxer_stream_.reset(); | 450 decrypting_demuxer_stream_.reset(); |
| 452 base::ResetAndReturn(&stop_cb_).Run(); | 451 base::ResetAndReturn(&stop_cb_).Run(); |
| 453 } | 452 } |
| 454 | 453 |
| 455 } // namespace media | 454 } // namespace media |
| OLD | NEW |