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

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

Issue 57403003: Remove EMPTY from VideoFrame::Format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vframe_rgb
Patch Set: Created 7 years, 1 month 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/video_frame_unittest.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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 decode_cb_ = BindToCurrentLoop(decode_cb); 74 decode_cb_ = BindToCurrentLoop(decode_cb);
75 75
76 if (state_ == kError) { 76 if (state_ == kError) {
77 base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL); 77 base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL);
78 return; 78 return;
79 } 79 }
80 80
81 // Return empty frames if decoding has finished. 81 // Return empty frames if decoding has finished.
82 if (state_ == kDecodeFinished) { 82 if (state_ == kDecodeFinished) {
83 base::ResetAndReturn(&decode_cb_).Run(kOk, VideoFrame::CreateEmptyFrame()); 83 base::ResetAndReturn(&decode_cb_).Run(kOk, VideoFrame::CreateEOSFrame());
84 return; 84 return;
85 } 85 }
86 86
87 pending_buffer_to_decode_ = buffer; 87 pending_buffer_to_decode_ = buffer;
88 state_ = kPendingDecode; 88 state_ = kPendingDecode;
89 DecodePendingBuffer(); 89 DecodePendingBuffer();
90 } 90 }
91 91
92 void DecryptingVideoDecoder::Reset(const base::Closure& closure) { 92 void DecryptingVideoDecoder::Reset(const base::Closure& closure) {
93 DVLOG(2) << "Reset() - state: " << state_; 93 DVLOG(2) << "Reset() - state: " << state_;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 state_ = kWaitingForKey; 276 state_ = kWaitingForKey;
277 return; 277 return;
278 } 278 }
279 279
280 if (status == Decryptor::kNeedMoreData) { 280 if (status == Decryptor::kNeedMoreData) {
281 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; 281 DVLOG(2) << "DeliverFrame() - kNeedMoreData";
282 if (scoped_pending_buffer_to_decode->end_of_stream()) { 282 if (scoped_pending_buffer_to_decode->end_of_stream()) {
283 state_ = kDecodeFinished; 283 state_ = kDecodeFinished;
284 base::ResetAndReturn(&decode_cb_).Run( 284 base::ResetAndReturn(&decode_cb_).Run(
285 kOk, media::VideoFrame::CreateEmptyFrame()); 285 kOk, media::VideoFrame::CreateEOSFrame());
286 return; 286 return;
287 } 287 }
288 288
289 state_ = kIdle; 289 state_ = kIdle;
290 base::ResetAndReturn(&decode_cb_).Run(kNotEnoughData, NULL); 290 base::ResetAndReturn(&decode_cb_).Run(kNotEnoughData, NULL);
291 return; 291 return;
292 } 292 }
293 293
294 DCHECK_EQ(status, Decryptor::kSuccess); 294 DCHECK_EQ(status, Decryptor::kSuccess);
295 // No frame returned with kSuccess should be end-of-stream frame. 295 // No frame returned with kSuccess should be end-of-stream frame.
296 DCHECK(!frame->IsEndOfStream()); 296 DCHECK(!frame->end_of_stream());
297 state_ = kIdle; 297 state_ = kIdle;
298 base::ResetAndReturn(&decode_cb_).Run(kOk, frame); 298 base::ResetAndReturn(&decode_cb_).Run(kOk, frame);
299 } 299 }
300 300
301 void DecryptingVideoDecoder::OnKeyAdded() { 301 void DecryptingVideoDecoder::OnKeyAdded() {
302 DVLOG(2) << "OnKeyAdded()"; 302 DVLOG(2) << "OnKeyAdded()";
303 DCHECK(message_loop_->BelongsToCurrentThread()); 303 DCHECK(message_loop_->BelongsToCurrentThread());
304 304
305 if (state_ == kPendingDecode) { 305 if (state_ == kPendingDecode) {
306 key_added_while_decode_pending_ = true; 306 key_added_while_decode_pending_ = true;
307 return; 307 return;
308 } 308 }
309 309
310 if (state_ == kWaitingForKey) { 310 if (state_ == kWaitingForKey) {
311 state_ = kPendingDecode; 311 state_ = kPendingDecode;
312 DecodePendingBuffer(); 312 DecodePendingBuffer();
313 } 313 }
314 } 314 }
315 315
316 void DecryptingVideoDecoder::DoReset() { 316 void DecryptingVideoDecoder::DoReset() {
317 DCHECK(init_cb_.is_null()); 317 DCHECK(init_cb_.is_null());
318 DCHECK(decode_cb_.is_null()); 318 DCHECK(decode_cb_.is_null());
319 state_ = kIdle; 319 state_ = kIdle;
320 base::ResetAndReturn(&reset_cb_).Run(); 320 base::ResetAndReturn(&reset_cb_).Run();
321 } 321 }
322 322
323 } // namespace media 323 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame_unittest.cc ('k') | media/filters/decrypting_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698