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

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

Issue 2872223002: media: Set ColorSpace on decoded frames in DecryptingVideoDecoder (Closed)
Patch Set: more fix and test Created 3 years, 7 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
« no previous file with comments | « media/base/test_helpers.cc ('k') | media/filters/decrypting_video_decoder_unittest.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/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
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().IsValid()) {
283 DVLOG(3) << "Setting color space using information in the config.";
284 frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE,
285 config_.color_space());
286 if (config_.color_space_info() != VideoColorSpace())
287 frame->set_color_space(config_.color_space_info().ToGfxColorSpace());
288 }
289
280 output_cb_.Run(frame); 290 output_cb_.Run(frame);
281 291
282 if (scoped_pending_buffer_to_decode->end_of_stream()) { 292 if (scoped_pending_buffer_to_decode->end_of_stream()) {
283 // Set |pending_buffer_to_decode_| back as we need to keep flushing the 293 // Set |pending_buffer_to_decode_| back as we need to keep flushing the
284 // decryptor. 294 // decryptor.
285 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; 295 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode;
286 DecodePendingBuffer(); 296 DecodePendingBuffer();
287 return; 297 return;
288 } 298 }
289 299
(...skipping 19 matching lines...) Expand all
309 } 319 }
310 320
311 void DecryptingVideoDecoder::DoReset() { 321 void DecryptingVideoDecoder::DoReset() {
312 DCHECK(init_cb_.is_null()); 322 DCHECK(init_cb_.is_null());
313 DCHECK(decode_cb_.is_null()); 323 DCHECK(decode_cb_.is_null());
314 state_ = kIdle; 324 state_ = kIdle;
315 base::ResetAndReturn(&reset_cb_).Run(); 325 base::ResetAndReturn(&reset_cb_).Run();
316 } 326 }
317 327
318 } // namespace media 328 } // namespace media
OLDNEW
« no previous file with comments | « media/base/test_helpers.cc ('k') | media/filters/decrypting_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698