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

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

Issue 17408005: Refactored DecoderBuffer to use unix_hacker_style naming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@localrefactor
Patch Set: Created 7 years, 5 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/filters/fake_demuxer_stream_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/fake_video_decoder.h" 5 #include "media/filters/fake_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/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 init_cb_.RunOrHold(PIPELINE_OK); 47 init_cb_.RunOrHold(PIPELINE_OK);
48 } 48 }
49 49
50 void FakeVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, 50 void FakeVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
51 const ReadCB& read_cb) { 51 const ReadCB& read_cb) {
52 DCHECK(message_loop_->BelongsToCurrentThread()); 52 DCHECK(message_loop_->BelongsToCurrentThread());
53 DCHECK(read_cb_.IsNull()) << "Overlapping decodes are not supported."; 53 DCHECK(read_cb_.IsNull()) << "Overlapping decodes are not supported.";
54 DCHECK(reset_cb_.IsNull()); 54 DCHECK(reset_cb_.IsNull());
55 DCHECK_LE(decoded_frames_.size(), static_cast<size_t>(decoding_delay_)); 55 DCHECK_LE(decoded_frames_.size(), static_cast<size_t>(decoding_delay_));
56 56
57 int buffer_size = buffer->IsEndOfStream() ? 0 : buffer->GetDataSize(); 57 int buffer_size = buffer->end_of_stream() ? 0 : buffer->data_size();
58 read_cb_.SetCallback(BindToCurrentLoop(base::Bind( 58 read_cb_.SetCallback(BindToCurrentLoop(base::Bind(
59 &FakeVideoDecoder::OnFrameDecoded, weak_this_, buffer_size, read_cb))); 59 &FakeVideoDecoder::OnFrameDecoded, weak_this_, buffer_size, read_cb)));
60 60
61 if (buffer->IsEndOfStream() && decoded_frames_.empty()) { 61 if (buffer->end_of_stream() && decoded_frames_.empty()) {
62 read_cb_.RunOrHold(kOk, VideoFrame::CreateEmptyFrame()); 62 read_cb_.RunOrHold(kOk, VideoFrame::CreateEmptyFrame());
63 return; 63 return;
64 } 64 }
65 65
66 if (!buffer->IsEndOfStream()) { 66 if (!buffer->end_of_stream()) {
67 DCHECK(VerifyFakeVideoBufferForTest(buffer, current_config_)); 67 DCHECK(VerifyFakeVideoBufferForTest(buffer, current_config_));
68 scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateColorFrame( 68 scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateColorFrame(
69 current_config_.coded_size(), 0, 0, 0, buffer->GetTimestamp()); 69 current_config_.coded_size(), 0, 0, 0, buffer->timestamp());
70 decoded_frames_.push_back(video_frame); 70 decoded_frames_.push_back(video_frame);
71 71
72 if (decoded_frames_.size() <= static_cast<size_t>(decoding_delay_)) { 72 if (decoded_frames_.size() <= static_cast<size_t>(decoding_delay_)) {
73 read_cb_.RunOrHold(kNotEnoughData, scoped_refptr<VideoFrame>()); 73 read_cb_.RunOrHold(kNotEnoughData, scoped_refptr<VideoFrame>());
74 return; 74 return;
75 } 75 }
76 } 76 }
77 77
78 scoped_refptr<VideoFrame> frame = decoded_frames_.front(); 78 scoped_refptr<VideoFrame> frame = decoded_frames_.front();
79 decoded_frames_.pop_front(); 79 decoded_frames_.pop_front();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 int buffer_size, 185 int buffer_size,
186 const ReadCB& read_cb, 186 const ReadCB& read_cb,
187 Status status, 187 Status status,
188 const scoped_refptr<VideoFrame>& video_frame) { 188 const scoped_refptr<VideoFrame>& video_frame) {
189 if (status == kOk || status == kNotEnoughData) 189 if (status == kOk || status == kNotEnoughData)
190 total_bytes_decoded_ += buffer_size; 190 total_bytes_decoded_ += buffer_size;
191 read_cb.Run(status, video_frame); 191 read_cb.Run(status, video_frame);
192 } 192 }
193 193
194 } // namespace media 194 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/fake_demuxer_stream_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698