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

Side by Side Diff: content/renderer/media/rtc_video_decoder_bridge_tv.cc

Issue 20646003: To dropp the decode done callback in RTCVideoDecoderBridgeTv. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dropping decode done callback Created 7 years, 4 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
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/rtc_video_decoder_bridge_tv.h" 5 #include "content/renderer/media/rtc_video_decoder_bridge_tv.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 // |input_image_| may be destroyed after this call, so we make a copy of the 85 // |input_image_| may be destroyed after this call, so we make a copy of the
86 // buffer so that we can queue the buffer asynchronously. 86 // buffer so that we can queue the buffer asynchronously.
87 scoped_refptr<media::DecoderBuffer> buffer = 87 scoped_refptr<media::DecoderBuffer> buffer =
88 media::DecoderBuffer::CopyFrom(input_image._buffer, input_image._length); 88 media::DecoderBuffer::CopyFrom(input_image._buffer, input_image._length);
89 if (render_time_ms != -1) { 89 if (render_time_ms != -1) {
90 buffer->set_timestamp(base::TimeDelta::FromMilliseconds( 90 buffer->set_timestamp(base::TimeDelta::FromMilliseconds(
91 render_time_ms - timestamp_offset_millis_)); 91 render_time_ms - timestamp_offset_millis_));
92 } 92 }
93 93
94 factory_->QueueBuffer( 94 factory_->QueueBuffer(buffer, new_size);
95 buffer,
96 base::Bind(&RTCVideoDecoderBridgeTv::RunDecodeCompleteCallback,
97 decode_complete_callback_,
98 input_image._timeStamp,
99 size_),
100 new_size);
101 95
102 return WEBRTC_VIDEO_CODEC_OK; 96 return WEBRTC_VIDEO_CODEC_OK;
103 } 97 }
104 98
105 int32_t RTCVideoDecoderBridgeTv::RegisterDecodeCompleteCallback( 99 int32_t RTCVideoDecoderBridgeTv::RegisterDecodeCompleteCallback(
106 webrtc::DecodedImageCallback* callback) { 100 webrtc::DecodedImageCallback* callback) {
107 decode_complete_callback_ = callback; 101 decode_complete_callback_ = callback;
108 return WEBRTC_VIDEO_CODEC_OK; 102 return WEBRTC_VIDEO_CODEC_OK;
109 } 103 }
110 104
111 int32_t RTCVideoDecoderBridgeTv::Release() { 105 int32_t RTCVideoDecoderBridgeTv::Release() {
112 is_initialized_ = false; 106 is_initialized_ = false;
113 return WEBRTC_VIDEO_CODEC_OK; 107 return WEBRTC_VIDEO_CODEC_OK;
114 } 108 }
115 109
116 int32_t RTCVideoDecoderBridgeTv::Reset() { 110 int32_t RTCVideoDecoderBridgeTv::Reset() {
117 first_frame_ = true; 111 first_frame_ = true;
118 return WEBRTC_VIDEO_CODEC_OK; 112 return WEBRTC_VIDEO_CODEC_OK;
119 } 113 }
120 114
121 // static
122 void RTCVideoDecoderBridgeTv::RunDecodeCompleteCallback(
123 webrtc::DecodedImageCallback* callback,
124 int64_t timestamp,
125 gfx::Size size) {
126 // We call the decode complete callback function to notify libjingle that
127 // decoding is finished. In addition, this also reports back to libjingle that
128 // the particular video frame with |timestamp| is correctly rendered to
129 // libjingle, so that it can generate proper stats.
130 webrtc::I420VideoFrame dummy_video_frame;
131 int half_width = (size.width() + 1) / 2;
132 dummy_video_frame.CreateEmptyFrame(
133 size.width(), size.height(), size.width(), half_width, half_width);
134 dummy_video_frame.set_timestamp(timestamp);
135 callback->Decoded(dummy_video_frame);
136 }
137
138 } // namespace content 115 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698