OLD | NEW |
---|---|
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 if (buffer->end_of_stream() && decoded_frames_.empty()) { | 64 if (buffer->end_of_stream() && decoded_frames_.empty()) { |
65 decode_cb_.RunOrHold(kOk, VideoFrame::CreateEOSFrame()); | 65 decode_cb_.RunOrHold(kOk, VideoFrame::CreateEOSFrame()); |
66 return; | 66 return; |
67 } | 67 } |
68 | 68 |
69 if (!buffer->end_of_stream()) { | 69 if (!buffer->end_of_stream()) { |
70 DCHECK(VerifyFakeVideoBufferForTest(buffer, current_config_)); | 70 DCHECK(VerifyFakeVideoBufferForTest(buffer, current_config_)); |
71 scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateColorFrame( | 71 scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateColorFrame( |
72 current_config_.coded_size(), 0, 0, 0, buffer->timestamp()); | 72 current_config_.coded_size(), 0, 0, 0, buffer->timestamp()); |
73 decoded_frames_.push_back(video_frame); | 73 decoded_frames_.push_back(video_frame); |
74 LOG(ERROR) << "Queue " << decoded_frames_.size(); | |
Ami GONE FROM CHROMIUM
2014/04/16 01:00:00
drop?
Sergey Ulanov
2014/04/16 01:44:14
Done.
| |
74 | 75 |
75 if (decoded_frames_.size() <= static_cast<size_t>(decoding_delay_)) { | 76 if (decoded_frames_.size() <= static_cast<size_t>(decoding_delay_)) { |
76 decode_cb_.RunOrHold(kNotEnoughData, scoped_refptr<VideoFrame>()); | 77 decode_cb_.RunOrHold(kNotEnoughData, scoped_refptr<VideoFrame>()); |
77 return; | 78 return; |
78 } | 79 } |
79 } | 80 } |
80 | 81 |
81 scoped_refptr<VideoFrame> frame = decoded_frames_.front(); | 82 scoped_refptr<VideoFrame> frame = decoded_frames_.front(); |
82 decoded_frames_.pop_front(); | 83 decoded_frames_.pop_front(); |
84 LOG(ERROR) << "Queue " << decoded_frames_.size(); | |
Ami GONE FROM CHROMIUM
2014/04/16 01:00:00
drop?
Sergey Ulanov
2014/04/16 01:44:14
Done.
| |
83 decode_cb_.RunOrHold(kOk, frame); | 85 decode_cb_.RunOrHold(kOk, frame); |
84 } | 86 } |
85 | 87 |
86 void FakeVideoDecoder::Reset(const base::Closure& closure) { | 88 void FakeVideoDecoder::Reset(const base::Closure& closure) { |
87 DCHECK(task_runner_->BelongsToCurrentThread()); | 89 DCHECK(task_runner_->BelongsToCurrentThread()); |
88 DCHECK(reset_cb_.IsNull()); | 90 DCHECK(reset_cb_.IsNull()); |
89 reset_cb_.SetCallback(BindToCurrentLoop(closure)); | 91 reset_cb_.SetCallback(BindToCurrentLoop(closure)); |
90 | 92 |
91 // Defer the reset if a decode is pending. | 93 // Defer the reset if a decode is pending. |
92 if (!decode_cb_.IsNull()) | 94 if (!decode_cb_.IsNull()) |
(...skipping 15 matching lines...) Expand all Loading... | |
108 decoded_frames_.clear(); | 110 decoded_frames_.clear(); |
109 state_ = UNINITIALIZED; | 111 state_ = UNINITIALIZED; |
110 } | 112 } |
111 | 113 |
112 scoped_refptr<VideoFrame> FakeVideoDecoder::GetDecodeOutput() { | 114 scoped_refptr<VideoFrame> FakeVideoDecoder::GetDecodeOutput() { |
113 DCHECK(task_runner_->BelongsToCurrentThread()); | 115 DCHECK(task_runner_->BelongsToCurrentThread()); |
114 if (!supports_get_decode_output_ || decoded_frames_.empty()) | 116 if (!supports_get_decode_output_ || decoded_frames_.empty()) |
115 return NULL; | 117 return NULL; |
116 scoped_refptr<VideoFrame> out = decoded_frames_.front(); | 118 scoped_refptr<VideoFrame> out = decoded_frames_.front(); |
117 decoded_frames_.pop_front(); | 119 decoded_frames_.pop_front(); |
120 LOG(ERROR) << "Queue " << decoded_frames_.size(); | |
Ami GONE FROM CHROMIUM
2014/04/16 01:00:00
drop?
Sergey Ulanov
2014/04/16 01:44:14
Done.
| |
118 return out; | 121 return out; |
119 } | 122 } |
120 | 123 |
121 void FakeVideoDecoder::HoldNextInit() { | 124 void FakeVideoDecoder::HoldNextInit() { |
122 DCHECK(task_runner_->BelongsToCurrentThread()); | 125 DCHECK(task_runner_->BelongsToCurrentThread()); |
123 init_cb_.HoldCallback(); | 126 init_cb_.HoldCallback(); |
124 } | 127 } |
125 | 128 |
126 void FakeVideoDecoder::HoldNextDecode() { | 129 void FakeVideoDecoder::HoldNextDecode() { |
127 DCHECK(task_runner_->BelongsToCurrentThread()); | 130 DCHECK(task_runner_->BelongsToCurrentThread()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 int buffer_size, | 171 int buffer_size, |
169 const DecodeCB& decode_cb, | 172 const DecodeCB& decode_cb, |
170 Status status, | 173 Status status, |
171 const scoped_refptr<VideoFrame>& video_frame) { | 174 const scoped_refptr<VideoFrame>& video_frame) { |
172 if (status == kOk || status == kNotEnoughData) | 175 if (status == kOk || status == kNotEnoughData) |
173 total_bytes_decoded_ += buffer_size; | 176 total_bytes_decoded_ += buffer_size; |
174 decode_cb.Run(status, video_frame); | 177 decode_cb.Run(status, video_frame); |
175 } | 178 } |
176 | 179 |
177 } // namespace media | 180 } // namespace media |
OLD | NEW |