| 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 "content/renderer/media/rtc_video_decoder.h" | 5 #include "content/renderer/media/rtc_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 got_first_frame_ = true; | 154 got_first_frame_ = true; |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Always allocate a new frame. | 157 // Always allocate a new frame. |
| 158 // | 158 // |
| 159 // TODO(scherkus): migrate this to proper buffer recycling. | 159 // TODO(scherkus): migrate this to proper buffer recycling. |
| 160 scoped_refptr<media::VideoFrame> video_frame = | 160 scoped_refptr<media::VideoFrame> video_frame = |
| 161 media::VideoFrame::CreateFrame(media::VideoFrame::YV12, | 161 media::VideoFrame::CreateFrame(media::VideoFrame::YV12, |
| 162 visible_size_.width(), | 162 visible_size_.width(), |
| 163 visible_size_.height(), | 163 visible_size_.height(), |
| 164 timestamp - start_time_, | 164 timestamp - start_time_); |
| 165 base::TimeDelta::FromMilliseconds(0)); | |
| 166 last_frame_timestamp_ = timestamp; | 165 last_frame_timestamp_ = timestamp; |
| 167 | 166 |
| 168 // Aspect ratio unsupported; DCHECK when there are non-square pixels. | 167 // Aspect ratio unsupported; DCHECK when there are non-square pixels. |
| 169 DCHECK_EQ(frame->GetPixelWidth(), 1u); | 168 DCHECK_EQ(frame->GetPixelWidth(), 1u); |
| 170 DCHECK_EQ(frame->GetPixelHeight(), 1u); | 169 DCHECK_EQ(frame->GetPixelHeight(), 1u); |
| 171 | 170 |
| 172 int y_rows = frame->GetHeight(); | 171 int y_rows = frame->GetHeight(); |
| 173 int uv_rows = frame->GetHeight() / 2; // YV12 format. | 172 int uv_rows = frame->GetHeight() / 2; // YV12 format. |
| 174 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); | 173 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); |
| 175 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); | 174 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 201 DCHECK(main_thread_->RunsTasksOnCurrentThread()); | 200 DCHECK(main_thread_->RunsTasksOnCurrentThread()); |
| 202 if (video_track_) { | 201 if (video_track_) { |
| 203 video_track_->RemoveRenderer(this); | 202 video_track_->RemoveRenderer(this); |
| 204 video_track_ = NULL; | 203 video_track_ = NULL; |
| 205 } | 204 } |
| 206 } | 205 } |
| 207 | 206 |
| 208 RTCVideoDecoder::~RTCVideoDecoder() { | 207 RTCVideoDecoder::~RTCVideoDecoder() { |
| 209 DCHECK_NE(kNormal, state_); | 208 DCHECK_NE(kNormal, state_); |
| 210 } | 209 } |
| OLD | NEW |