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

Unified Diff: webrtc/examples/peerconnection/client/conductor.cc

Issue 2083903003: Tried to reproduce the issue with AudioTrackSinkInterface::OnData (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/examples/peerconnection/client/conductor.cc
diff --git a/webrtc/examples/peerconnection/client/conductor.cc b/webrtc/examples/peerconnection/client/conductor.cc
index 1b656512a0576bcb0d61f31710fa53ef81878c28..5afc633b777cd3f86a7bc8675cdde03494a80fe3 100644
--- a/webrtc/examples/peerconnection/client/conductor.cc
+++ b/webrtc/examples/peerconnection/client/conductor.cc
@@ -10,6 +10,7 @@
#include "webrtc/examples/peerconnection/client/conductor.h"
+#include <iostream>
#include <memory>
#include <utility>
#include <vector>
@@ -34,6 +35,22 @@ const char kSessionDescriptionSdpName[] = "sdp";
#define DTLS_ON true
#define DTLS_OFF false
+class MyAudioSink : public webrtc::AudioTrackSinkInterface {
+ public:
+ MyAudioSink() { std::cout << "[Sink] Constructing new sink!" << std::endl; }
+ void OnData(const void* audio_data,
+ int bits_per_sample,
+ int sample_rate,
+ size_t number_of_channels,
+ size_t number_of_frames) {
+ std::cout << "[Sink] bits per sample: " << bits_per_sample << "\n"
+ << "[Sink] sample rate: " << sample_rate << "\n"
+ << "[Sink] #channels: " << number_of_channels << "\n"
+ << "[Sink] #frames: " << number_of_frames
+ << std::endl;
+ }
+};
+
class DummySetSessionDescriptionObserver
: public webrtc::SetSessionDescriptionObserver {
public:
@@ -493,6 +510,12 @@ void Conductor::UIThreadCallback(int msg_id, void* data) {
webrtc::VideoTrackInterface* track = tracks[0];
main_wnd_->StartRemoteRenderer(track);
}
+
+ webrtc::AudioTrackVector audio_tracks = stream->GetAudioTracks();
+ for (auto & audio_track : audio_tracks) {
+ audio_track->AddSink(new MyAudioSink());
+ }
+
stream->Release();
break;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698