Skip to content

Commit 91ba733

Browse files
committed
TEST - DO NOT MERGE
Signed-off-by: ryadav698 <[email protected]>
1 parent fd10360 commit 91ba733

File tree

3 files changed

+68
-77
lines changed

3 files changed

+68
-77
lines changed

test/gstTestHarness/rialto-api-test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void InjectAudio()
142142
LoadAndDemuxSegment(trackAudio, "audio/chunk-stream0-00001.m4s");
143143
std::cout << "loading rialtotest /tmp/data/bipbop-gen/audio/chunk-stream0-00001.m4s" << std::endl;
144144

145-
size_t segmentCount = trackAudio.getSegmentCount();
145+
size_t segmentCount = trackAudio.getNbSegments(); // Corrected function name
146146
printf("adding %zu audio frames\n", segmentCount);
147147

148148
for (size_t i = 0; i < segmentCount; ++i)
@@ -171,7 +171,7 @@ void InjectVideo()
171171
LoadAndDemuxSegment(trackVideo, "video/chunk-stream0-00001.m4s");
172172
std::cout << "loading rialtotest /tmp/data/bipbop-gen/video/chunk-stream0-00001.m4s" << std::endl;
173173

174-
size_t segmentCount = trackVideo.getSegmentCount();
174+
size_t segmentCount = trackVideo.getNbSegments(); // Corrected function name
175175
printf("adding %zu video frames\n", segmentCount);
176176

177177
for (size_t i = 0; i < segmentCount; ++i)

test/gstTestHarness/rialto-gst-pipeline.cpp

Lines changed: 54 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <cassert>
55
#include <cstring>
66

7+
using namespace firebolt::rialto;
8+
79
GstMediaPipeline::GstMediaPipeline()
810
{
911
std::cout << "Constructing GstMediaPipeline (Rialto-managed, public API)\n";
@@ -19,96 +21,57 @@ GstMediaPipeline::~GstMediaPipeline()
1921

2022
bool GstMediaPipeline::init()
2123
{
22-
std::shared_ptr<IMediaPipelineFactory> factory = IMediaPipelineFactory::createFactory();
23-
if (!factory)
24-
{
25-
std::cerr << "[GstMediaPipeline] ERROR: Failed to create IMediaPipelineFactory.\n";
26-
return false;
27-
}
28-
VideoRequirements requirements = {1920, 1080};
24+
std::shared_ptr<IMediaPipelineFactory> factory = IMediaPipeline::createFactory();
25+
if (!factory) return false;
2926

27+
VideoRequirements requirements = {};
28+
3029
m_pipeline = factory->createMediaPipeline(weak_from_this(), requirements);
31-
32-
if (!m_pipeline)
33-
{
34-
std::cerr << "[GstMediaPipeline] ERROR: Failed to create Remote MediaPipeline. Is Rialto Server running?\n";
35-
return false;
36-
}
37-
38-
std::cout << "[GstMediaPipeline] SUCCESS: Rialto IPC Pipeline created.\n";
39-
return true;
40-
}
41-
42-
bool GstMediaPipeline::attachSource(std::unique_ptr<MediaSource> &&source, int32_t &sourceId)
43-
{
44-
return m_pipeline ? m_pipeline->attachSource(std::move(source), sourceId) : false;
45-
}
46-
47-
bool GstMediaPipeline::play()
48-
{
49-
return m_pipeline ? m_pipeline->play() : false;
50-
}
51-
52-
bool GstMediaPipeline::stop()
53-
{
54-
return m_pipeline ? m_pipeline->stop() : false;
55-
}
56-
57-
bool GstMediaPipeline::setVideoWindow(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
58-
{
59-
std::cout << "[GstMediaPipeline] Forwarding setVideoWindow to Rialto Server: " << width << "x" << height << "\n";
60-
return m_pipeline ? m_pipeline->setVideoWindow(x, y, width, height) : false;
61-
}
62-
63-
bool GstMediaPipeline::removeSource(int32_t id)
64-
{
65-
return m_pipeline ? m_pipeline->removeSource(id) : false;
66-
}
67-
68-
bool GstMediaPipeline::allSourcesAttached()
69-
{
70-
return m_pipeline ? m_pipeline->allSourcesAttached() : false;
71-
}
72-
73-
bool GstMediaPipeline::load(MediaType type, const std::string &mimeType, const std::string &url)
74-
{
75-
return m_pipeline ? m_pipeline->load(type, mimeType, url) : false;
30+
31+
return m_pipeline != nullptr;
7632
}
7733

78-
AddSegmentStatus GstMediaPipeline::addSegment(uint32_t needDataRequestId, const std::unique_ptr<MediaSegment> &mediaSegment)
34+
bool GstMediaPipeline::attachSource(const std::unique_ptr<MediaSource> &source)
7935
{
80-
return m_pipeline ? m_pipeline->addSegment(needDataRequestId, mediaSegment) : AddSegmentStatus::ERROR;
36+
return m_pipeline ? m_pipeline->attachSource(source) : false;
8137
}
8238

83-
void GstMediaPipeline::notifyPlaybackState(PlaybackState state)
84-
{
85-
std::cout << "[Rialto Callback] PlaybackState: " << (int)state << "\n";
86-
}
87-
88-
void GstMediaPipeline::notifyPlaybackError(int32_t sourceId, PlaybackError error)
39+
bool GstMediaPipeline::attachSource(std::unique_ptr<MediaSource> &&source, int32_t &sourceId)
8940
{
90-
std::cerr << "[Rialto Callback] ERROR on source " << sourceId << ": " << (int)error << "\n";
91-
}
92-
93-
void GstMediaPipeline::notifyPosition(int64_t position) {}
94-
void GstMediaPipeline::notifyNetworkState(NetworkState state) {}
95-
void GstMediaPipeline::notifyQos(int32_t sourceId, const QosInfo &qosInfo) {}
96-
void GstMediaPipeline::notifyBufferUnderflow(int32_t sourceId) {}
97-
void GstMediaPipeline::notifySourceFlushed(int32_t sourceId) {}
41+
if (!source)
42+
{
43+
sourceId = 0;
44+
return false;
45+
}
46+
47+
bool ok = attachSource(source);
9848

99-
void GstMediaPipeline::notifyNeedMediaData(int32_t sourceId, size_t frameCount,
100-
uint32_t needDataRequestId,
101-
const std::shared_ptr<MediaPlayerShmInfo> &mediaPlayerShmInfo)
102-
{
49+
if (ok)
50+
{
51+
sourceId = source->getId();
52+
}
53+
else
54+
{
55+
sourceId = 0;
56+
}
57+
58+
return ok;
10359
}
10460

61+
bool GstMediaPipeline::play() { return m_pipeline ? m_pipeline->play() : false; }
62+
bool GstMediaPipeline::stop() { return m_pipeline ? m_pipeline->stop() : false; }
63+
bool GstMediaPipeline::removeSource(int32_t id) { return m_pipeline ? m_pipeline->removeSource(id) : false; }
64+
bool GstMediaPipeline::allSourcesAttached() { return m_pipeline ? m_pipeline->allSourcesAttached() : false; }
65+
bool GstMediaPipeline::load(MediaType type, const std::string &mimeType, const std::string &url) { return m_pipeline ? m_pipeline->load(type, mimeType, url) : false; }
66+
AddSegmentStatus GstMediaPipeline::addSegment(uint32_t needDataRequestId, const std::unique_ptr<MediaSegment> &mediaSegment) { return m_pipeline ? m_pipeline->addSegment(needDataRequestId, mediaSegment) : AddSegmentStatus::ERROR; }
10567
bool GstMediaPipeline::pause() { return m_pipeline ? m_pipeline->pause() : false; }
10668
bool GstMediaPipeline::setPlaybackRate(double rate) { return m_pipeline ? m_pipeline->setPlaybackRate(rate) : false; }
10769
bool GstMediaPipeline::setPosition(int64_t position) { return m_pipeline ? m_pipeline->setPosition(position) : false; }
10870
bool GstMediaPipeline::getPosition(int64_t &position) { return m_pipeline ? m_pipeline->getPosition(position) : false; }
10971
bool GstMediaPipeline::getStats(int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames) { return m_pipeline ? m_pipeline->getStats(sourceId, renderedFrames, droppedFrames) : false; }
11072
bool GstMediaPipeline::setImmediateOutput(int32_t sourceId, bool immediateOutput) { return m_pipeline ? m_pipeline->setImmediateOutput(sourceId, immediateOutput) : false; }
11173
bool GstMediaPipeline::getImmediateOutput(int32_t sourceId, bool &immediateOutput) { return m_pipeline ? m_pipeline->getImmediateOutput(sourceId, immediateOutput) : false; }
74+
bool GstMediaPipeline::setVideoWindow(uint32_t x, uint32_t y, uint32_t width, uint32_t height) { return m_pipeline ? m_pipeline->setVideoWindow(x, y, width, height) : false; }
11275
bool GstMediaPipeline::haveData(MediaSourceStatus status, uint32_t needDataRequestId) { return m_pipeline ? m_pipeline->haveData(status, needDataRequestId) : false; }
11376
bool GstMediaPipeline::renderFrame() { return m_pipeline ? m_pipeline->renderFrame() : false; }
11477
bool GstMediaPipeline::setVolume(double targetVolume, uint32_t volumeDuration, EaseType easeType) { return m_pipeline ? m_pipeline->setVolume(targetVolume, volumeDuration, easeType) : false; }
@@ -131,4 +94,22 @@ bool GstMediaPipeline::switchSource(const std::unique_ptr<MediaSource> &source)
13194
bool GstMediaPipeline::getVolume(double &currentVolume) { return m_pipeline ? m_pipeline->getVolume(currentVolume) : false; }
13295
bool GstMediaPipeline::setMute(int32_t sourceId, bool mute) { return m_pipeline ? m_pipeline->setMute(sourceId, mute) : false; }
13396
bool GstMediaPipeline::getMute(int32_t sourceId, bool &mute) { return m_pipeline ? m_pipeline->getMute(sourceId, mute) : false; }
134-
bool GstMediaPipeline::setTextTrackIdentifier(const std::string &textTrackIdentifier) { return m_pipeline ? m_pipeline->setTextTrackIdentifier(textTrackIdentifier) : false; }
97+
bool GstMediaPipeline::setTextTrackIdentifier(const std::string &textTrackIdentifier) { return m_pipeline ? m_pipeline->setTextTrackIdentifier(textTrackIdentifier) : false; }
98+
99+
// --- IMediaPipelineClient stubs ---
100+
101+
void GstMediaPipeline::notifyPlaybackState(PlaybackState state) { }
102+
void GstMediaPipeline::notifyPlaybackError(int32_t sourceId, PlaybackError error) { }
103+
void GstMediaPipeline::notifyPosition(int64_t position) {}
104+
void GstMediaPipeline::notifyNetworkState(NetworkState state) {}
105+
void GstMediaPipeline::notifyQos(int32_t sourceId, const QosInfo &qosInfo) {}
106+
void GstMediaPipeline::notifyBufferUnderflow(int32_t sourceId) {}
107+
void GstMediaPipeline::notifySourceFlushed(int32_t sourceId) {}
108+
void GstMediaPipeline::notifyNeedMediaData(int32_t sourceId, size_t frameCount,
109+
uint32_t needDataRequestId,
110+
const std::shared_ptr<MediaPlayerShmInfo> &mediaPlayerShmInfo) {}
111+
void GstMediaPipeline::notifyDuration(int64_t duration) {}
112+
void GstMediaPipeline::notifyNativeSize(uint32_t width, uint32_t height, double aspect) {}
113+
void GstMediaPipeline::notifyVideoData(bool hasData) {}
114+
void GstMediaPipeline::notifyAudioData(bool hasData) {}
115+
void GstMediaPipeline::notifyCancelNeedMediaData(int32_t sourceId) {}

test/gstTestHarness/rialto-gst-pipeline.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class GstMediaPipeline : public IMediaPipeline,
2323

2424
std::weak_ptr<IMediaPipelineClient> getClient() override { return weak_from_this(); }
2525

26+
// IMediaPipelineClient Implementation (All required pure virtuals)
2627
void notifyNetworkState(NetworkState state) override;
2728
void notifyPlaybackState(PlaybackState state) override;
2829
void notifyPosition(int64_t position) override;
@@ -33,9 +34,18 @@ class GstMediaPipeline : public IMediaPipeline,
3334
void notifyBufferUnderflow(int32_t sourceId) override;
3435
void notifyPlaybackError(int32_t sourceId, PlaybackError error) override;
3536
void notifySourceFlushed(int32_t sourceId) override;
37+
void notifyDuration(int64_t duration) override;
38+
void notifyNativeSize(uint32_t width, uint32_t height, double aspect = 1.0) override;
39+
void notifyVideoData(bool hasData) override;
40+
void notifyAudioData(bool hasData) override;
41+
void notifyCancelNeedMediaData(int32_t sourceId) override;
42+
43+
// IMediaPipeline Implementation
44+
45+
46+
bool attachSource(const std::unique_ptr<MediaSource> &source) override;
47+
bool attachSource(std::unique_ptr<MediaSource> &&source, int32_t &sourceId);
3648

37-
bool attachSource(std::unique_ptr<MediaSource> &&source, int32_t &sourceId) override;
38-
bool attachSource(const std::unique_ptr<MediaSource> &source) override { return false; }
3949
bool removeSource(int32_t id) override;
4050
bool allSourcesAttached() override;
4151
bool load(MediaType type, const std::string &mimeType, const std::string &url) override;

0 commit comments

Comments
 (0)