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

Side by Side Diff: content/renderer/media/gpu/rtc_video_decoder.cc

Issue 2456443002: Add callback to copy texture backed frames in WebRtcVideoFrameAdapter (Closed)
Patch Set: Created 4 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
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 "content/renderer/media/gpu/rtc_video_decoder.h" 5 #include "content/renderer/media/gpu/rtc_video_decoder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 return; 423 return;
424 } 424 }
425 bool inserted = picture_buffers_at_display_ 425 bool inserted = picture_buffers_at_display_
426 .insert(std::make_pair(picture.picture_buffer_id(), 426 .insert(std::make_pair(picture.picture_buffer_id(),
427 pb.texture_ids()[0])) 427 pb.texture_ids()[0]))
428 .second; 428 .second;
429 DCHECK(inserted); 429 DCHECK(inserted);
430 430
431 // Create a WebRTC video frame. 431 // Create a WebRTC video frame.
432 webrtc::VideoFrame decoded_image( 432 webrtc::VideoFrame decoded_image(
433 new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(frame), timestamp, 0, 433 new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(
434 webrtc::kVideoRotation_0); 434 frame, WebRtcVideoFrameAdapter::CopyTextureFrameCallback()),
435 timestamp, 0, webrtc::kVideoRotation_0);
435 436
436 // Invoke decode callback. WebRTC expects no callback after Release. 437 // Invoke decode callback. WebRTC expects no callback after Release.
437 { 438 {
438 base::AutoLock auto_lock(lock_); 439 base::AutoLock auto_lock(lock_);
439 DCHECK(decode_complete_callback_); 440 DCHECK(decode_complete_callback_);
440 if (IsBufferAfterReset(picture.bitstream_buffer_id(), 441 if (IsBufferAfterReset(picture.bitstream_buffer_id(),
441 reset_bitstream_buffer_id_)) { 442 reset_bitstream_buffer_id_)) {
442 decode_complete_callback_->Decoded(decoded_image); 443 decode_complete_callback_->Decoded(decoded_image);
443 } 444 }
444 // Reset error counter as we successfully decoded a frame. 445 // Reset error counter as we successfully decoded a frame.
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 } 885 }
885 886
886 void RTCVideoDecoder::ClearPendingBuffers() { 887 void RTCVideoDecoder::ClearPendingBuffers() {
887 // Delete WebRTC input buffers. 888 // Delete WebRTC input buffers.
888 for (const auto& pending_buffer : pending_buffers_) 889 for (const auto& pending_buffer : pending_buffers_)
889 delete[] pending_buffer.first._buffer; 890 delete[] pending_buffer.first._buffer;
890 pending_buffers_.clear(); 891 pending_buffers_.clear();
891 } 892 }
892 893
893 } // namespace content 894 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698