Chromium Code Reviews| 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/decrypting_video_decoder.h" | 5 #include "media/filters/decrypting_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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 | 268 |
| 269 if (status == Decryptor::kNeedMoreData) { | 269 if (status == Decryptor::kNeedMoreData) { |
| 270 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; | 270 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; |
| 271 state_ = scoped_pending_buffer_to_decode->end_of_stream() ? kDecodeFinished | 271 state_ = scoped_pending_buffer_to_decode->end_of_stream() ? kDecodeFinished |
| 272 : kIdle; | 272 : kIdle; |
| 273 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::OK); | 273 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::OK); |
| 274 return; | 274 return; |
| 275 } | 275 } |
| 276 | 276 |
| 277 DCHECK_EQ(status, Decryptor::kSuccess); | 277 DCHECK_EQ(status, Decryptor::kSuccess); |
| 278 // No frame returned with kSuccess should be end-of-stream frame. | 278 // Frame returned with kSuccess should not be an end-of-stream frame. |
| 279 DCHECK(!frame->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM)); | 279 DCHECK(!frame->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM)); |
| 280 | |
| 281 // If color space is not set, use the color space in the |config_|. | |
| 282 if (frame->ColorSpace() == gfx::ColorSpace() && | |
|
hubbe
2017/05/10 17:23:11
It's probably better to use frame->ColorSpace().Is
xhwang
2017/05/10 20:17:23
Done and improved this block.
| |
| 283 config_.color_space_info() != VideoColorSpace()) { | |
| 284 frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE, | |
| 285 config_.color_space()); | |
| 286 frame->set_color_space(config_.color_space_info().ToGfxColorSpace()); | |
| 287 } | |
| 288 | |
| 280 output_cb_.Run(frame); | 289 output_cb_.Run(frame); |
| 281 | 290 |
| 282 if (scoped_pending_buffer_to_decode->end_of_stream()) { | 291 if (scoped_pending_buffer_to_decode->end_of_stream()) { |
| 283 // Set |pending_buffer_to_decode_| back as we need to keep flushing the | 292 // Set |pending_buffer_to_decode_| back as we need to keep flushing the |
| 284 // decryptor. | 293 // decryptor. |
| 285 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; | 294 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; |
| 286 DecodePendingBuffer(); | 295 DecodePendingBuffer(); |
| 287 return; | 296 return; |
| 288 } | 297 } |
| 289 | 298 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 309 } | 318 } |
| 310 | 319 |
| 311 void DecryptingVideoDecoder::DoReset() { | 320 void DecryptingVideoDecoder::DoReset() { |
| 312 DCHECK(init_cb_.is_null()); | 321 DCHECK(init_cb_.is_null()); |
| 313 DCHECK(decode_cb_.is_null()); | 322 DCHECK(decode_cb_.is_null()); |
| 314 state_ = kIdle; | 323 state_ = kIdle; |
| 315 base::ResetAndReturn(&reset_cb_).Run(); | 324 base::ResetAndReturn(&reset_cb_).Run(); |
| 316 } | 325 } |
| 317 | 326 |
| 318 } // namespace media | 327 } // namespace media |
| OLD | NEW |