Chromium Code Reviews

Side by Side Diff: webrtc/video/video_receive_stream.cc

Issue 2089773002: Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: update SendOutgoingData() Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 303 matching lines...)
314 314
315 // config_.renderer must never be null if we're getting this callback. 315 // config_.renderer must never be null if we're getting this callback.
316 config_.renderer->OnFrame(video_frame); 316 config_.renderer->OnFrame(video_frame);
317 317
318 // TODO(tommi): OnRenderFrame grabs a lock too. 318 // TODO(tommi): OnRenderFrame grabs a lock too.
319 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); 319 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height());
320 } 320 }
321 321
322 // TODO(asapersson): Consider moving callback from video_encoder.h or 322 // TODO(asapersson): Consider moving callback from video_encoder.h or
323 // creating a different callback. 323 // creating a different callback.
324 int32_t VideoReceiveStream::Encoded( 324 EncodedImageCallback::Result VideoReceiveStream::OnEncodedImage(
325 const EncodedImage& encoded_image, 325 const EncodedImage& encoded_image,
326 const CodecSpecificInfo* codec_specific_info, 326 const CodecSpecificInfo* codec_specific_info,
327 const RTPFragmentationHeader* fragmentation) { 327 const RTPFragmentationHeader* fragmentation) {
328 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); 328 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info);
329 if (config_.pre_decode_callback) { 329 if (config_.pre_decode_callback) {
330 config_.pre_decode_callback->EncodedFrameCallback( 330 config_.pre_decode_callback->EncodedFrameCallback(
331 EncodedFrame(encoded_image._buffer, encoded_image._length, 331 EncodedFrame(encoded_image._buffer, encoded_image._length,
332 encoded_image._frameType)); 332 encoded_image._frameType));
333 } 333 }
334 if (kEnableFrameRecording) { 334 if (kEnableFrameRecording) {
335 if (!ivf_writer_.get()) { 335 if (!ivf_writer_.get()) {
336 RTC_DCHECK(codec_specific_info); 336 RTC_DCHECK(codec_specific_info);
337 std::ostringstream oss; 337 std::ostringstream oss;
338 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf"; 338 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf";
339 ivf_writer_ = 339 ivf_writer_ =
340 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); 340 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType);
341 } 341 }
342 if (ivf_writer_.get()) { 342 if (ivf_writer_.get()) {
343 bool ok = ivf_writer_->WriteFrame(encoded_image); 343 bool ok = ivf_writer_->WriteFrame(encoded_image);
344 RTC_DCHECK(ok); 344 RTC_DCHECK(ok);
345 } 345 }
346 } 346 }
347 347
348 return 0; 348 return Result(Result::OK, encoded_image._timeStamp);
349 } 349 }
350 350
351 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { 351 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) {
352 static_cast<VideoReceiveStream*>(ptr)->Decode(); 352 static_cast<VideoReceiveStream*>(ptr)->Decode();
353 return true; 353 return true;
354 } 354 }
355 355
356 void VideoReceiveStream::Decode() { 356 void VideoReceiveStream::Decode() {
357 static const int kMaxDecodeWaitTimeMs = 50; 357 static const int kMaxDecodeWaitTimeMs = 50;
358 video_receiver_.Decode(kMaxDecodeWaitTimeMs); 358 video_receiver_.Decode(kMaxDecodeWaitTimeMs);
359 } 359 }
360 360
361 void VideoReceiveStream::SendNack( 361 void VideoReceiveStream::SendNack(
362 const std::vector<uint16_t>& sequence_numbers) { 362 const std::vector<uint16_t>& sequence_numbers) {
363 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers); 363 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers);
364 } 364 }
365 365
366 void VideoReceiveStream::RequestKeyFrame() { 366 void VideoReceiveStream::RequestKeyFrame() {
367 rtp_stream_receiver_.RequestKeyFrame(); 367 rtp_stream_receiver_.RequestKeyFrame();
368 } 368 }
369 369
370 } // namespace internal 370 } // namespace internal
371 } // namespace webrtc 371 } // namespace webrtc
OLDNEW

Powered by Google App Engine