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

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: . Created 4 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
« no previous file with comments | « webrtc/video/video_receive_stream.h ('k') | webrtc/video/video_send_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 // config_.renderer must never be null if we're getting this callback. 318 // config_.renderer must never be null if we're getting this callback.
319 config_.renderer->OnFrame(video_frame); 319 config_.renderer->OnFrame(video_frame);
320 320
321 // TODO(tommi): OnRenderFrame grabs a lock too. 321 // TODO(tommi): OnRenderFrame grabs a lock too.
322 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); 322 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height());
323 } 323 }
324 324
325 // TODO(asapersson): Consider moving callback from video_encoder.h or 325 // TODO(asapersson): Consider moving callback from video_encoder.h or
326 // creating a different callback. 326 // creating a different callback.
327 int32_t VideoReceiveStream::Encoded( 327 EncodedImageCallback::Result VideoReceiveStream::OnEncodedImage(
328 const EncodedImage& encoded_image, 328 const EncodedImage& encoded_image,
329 const CodecSpecificInfo* codec_specific_info, 329 const CodecSpecificInfo* codec_specific_info,
330 const RTPFragmentationHeader* fragmentation) { 330 const RTPFragmentationHeader* fragmentation) {
331 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); 331 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info);
332 if (config_.pre_decode_callback) { 332 if (config_.pre_decode_callback) {
333 config_.pre_decode_callback->EncodedFrameCallback( 333 config_.pre_decode_callback->EncodedFrameCallback(
334 EncodedFrame(encoded_image._buffer, encoded_image._length, 334 EncodedFrame(encoded_image._buffer, encoded_image._length,
335 encoded_image._frameType)); 335 encoded_image._frameType));
336 } 336 }
337 if (kEnableFrameRecording) { 337 if (kEnableFrameRecording) {
338 if (!ivf_writer_.get()) { 338 if (!ivf_writer_.get()) {
339 RTC_DCHECK(codec_specific_info); 339 RTC_DCHECK(codec_specific_info);
340 std::ostringstream oss; 340 std::ostringstream oss;
341 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf"; 341 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf";
342 ivf_writer_ = 342 ivf_writer_ =
343 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); 343 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType);
344 } 344 }
345 if (ivf_writer_.get()) { 345 if (ivf_writer_.get()) {
346 bool ok = ivf_writer_->WriteFrame(encoded_image); 346 bool ok = ivf_writer_->WriteFrame(encoded_image);
347 RTC_DCHECK(ok); 347 RTC_DCHECK(ok);
348 } 348 }
349 } 349 }
350 350
351 return 0; 351 return Result(Result::OK, encoded_image._timeStamp);
352 } 352 }
353 353
354 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { 354 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) {
355 static_cast<VideoReceiveStream*>(ptr)->Decode(); 355 static_cast<VideoReceiveStream*>(ptr)->Decode();
356 return true; 356 return true;
357 } 357 }
358 358
359 void VideoReceiveStream::Decode() { 359 void VideoReceiveStream::Decode() {
360 static const int kMaxDecodeWaitTimeMs = 50; 360 static const int kMaxDecodeWaitTimeMs = 50;
361 video_receiver_.Decode(kMaxDecodeWaitTimeMs); 361 video_receiver_.Decode(kMaxDecodeWaitTimeMs);
362 } 362 }
363 363
364 void VideoReceiveStream::SendNack( 364 void VideoReceiveStream::SendNack(
365 const std::vector<uint16_t>& sequence_numbers) { 365 const std::vector<uint16_t>& sequence_numbers) {
366 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers); 366 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers);
367 } 367 }
368 368
369 void VideoReceiveStream::RequestKeyFrame() { 369 void VideoReceiveStream::RequestKeyFrame() {
370 rtp_stream_receiver_.RequestKeyFrame(); 370 rtp_stream_receiver_.RequestKeyFrame();
371 } 371 }
372 372
373 } // namespace internal 373 } // namespace internal
374 } // namespace webrtc 374 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_receive_stream.h ('k') | webrtc/video/video_send_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698