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

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

Issue 7044008: Initial implementation of stream switching in AdaptiveDemuxer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/threading/platform_thread.h" 7 #include "base/threading/platform_thread.h"
8 #include "media/base/buffers.h" 8 #include "media/base/buffers.h"
9 #include "media/base/callback.h" 9 #include "media/base/callback.h"
10 #include "media/base/filter_host.h" 10 #include "media/base/filter_host.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // we get video frame with time-stamp greater than the duration. 308 // we get video frame with time-stamp greater than the duration.
309 // In this case we should proceed anyway and try to obtain the 309 // In this case we should proceed anyway and try to obtain the
310 // end-of-stream packet. 310 // end-of-stream packet.
311 scoped_refptr<VideoFrame> timeout_frame; 311 scoped_refptr<VideoFrame> timeout_frame;
312 bool new_frame_available = false; 312 bool new_frame_available = false;
313 if (!pending_paint_) { 313 if (!pending_paint_) {
314 // In this case, current frame could be recycled. 314 // In this case, current frame could be recycled.
315 timeout_frame = current_frame_; 315 timeout_frame = current_frame_;
316 current_frame_ = frames_queue_ready_.front(); 316 current_frame_ = frames_queue_ready_.front();
317 frames_queue_ready_.pop_front(); 317 frames_queue_ready_.pop_front();
318
319 if (current_frame_->width() != width_ ||
320 current_frame_->height() != height_) {
Ami GONE FROM CHROMIUM 2011/05/19 20:27:37 I don't imagine we have any test coverage for the
acolwell GONE FROM CHROMIUM 2011/05/20 01:26:37 Removing the frame size changes for now. It was a
321 width_ = current_frame_->width();
322 height_ = current_frame_->height();
323 host()->SetVideoSize(width_, height_);
324 }
325
318 new_frame_available = true; 326 new_frame_available = true;
319 } else if (pending_paint_ && frames_queue_ready_.size() >= 2 && 327 } else if (pending_paint_ && frames_queue_ready_.size() >= 2 &&
320 !frames_queue_ready_[1]->IsEndOfStream()) { 328 !frames_queue_ready_[1]->IsEndOfStream()) {
321 // Painter could be really slow, therefore we had to skip frames if 329 // Painter could be really slow, therefore we had to skip frames if
322 // 1. We had not reached end of stream. 330 // 1. We had not reached end of stream.
323 // 2. The next frame of current frame is also out-dated. 331 // 2. The next frame of current frame is also out-dated.
324 base::TimeDelta next_remaining_time = 332 base::TimeDelta next_remaining_time =
325 frames_queue_ready_[1]->GetTimestamp() - host()->GetTime(); 333 frames_queue_ready_[1]->GetTimestamp() - host()->GetTime();
326 if (next_remaining_time.InMicroseconds() <= 0) { 334 if (next_remaining_time.InMicroseconds() <= 0) {
327 // Since the current frame is still hold by painter/compositor, and 335 // Since the current frame is still hold by painter/compositor, and
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 return; 625 return;
618 } 626 }
619 627
620 host()->SetError(status); 628 host()->SetError(status);
621 629
622 if (callback.get()) 630 if (callback.get())
623 callback->Run(); 631 callback->Run();
624 } 632 }
625 633
626 } // namespace media 634 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698