Why the buffer is 0 when I play the "rtsp" movie from the internet?

by yjshi » Mon, 31 Aug 2009 19:35:13 GMT


Sponsored Links
 Why the buffer is 0 when I play the "rtsp" movie from the internet?
I wrote a appliaction to play the movie from the internet.I try many
times and could not found out the reason ,so I decided to have a look
at opencore source code.
I look at the opencore source code ,and I find that it is the most
important code is below.But I could not find out how the percentage is
increasing .So I could not find out where the reason caused all
these.could someone give me a hand?
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€void PlayerDriver::HandleInformationalEvent(const
PVAsyncInformationalEvent& aEvent)
{
......
 case PVMFInfoBufferingStatus:
            {
                const void *buffer = aEvent.GetLocalBuffer();
                const size_t size = aEvent.GetLocalBufferSize();
                int percentage;
                if (GetBufferingPercentage(buffer, size, &percentage))
                {

                    //This place print the log "D/PlayerDriver(   31):
buffering (0)"
                    LOGD("buffering (%d)", percentage);

                    mPvPlayer->sendEvent(MEDIA_BUFFERING_UPDATE,
percentage);
                }
            }
            break;
......

-----------------------------------------------------------------------------------------------------
bool GetBufferingPercentage(const void *buffer,
                            const size_t size,
                            int *percentage)
{
    if (buffer == NULL) {
                LOGI(" GetBufferingPercentage  Invalid buffer: NULL");
                LOGE("Invalid buffer: NULL");
        return false;
    }
    if (sizeof(int) != size)
    {
        LOGE("Invalid percentage buffer size %d (expected %d)", size,
sizeof(int));
        return false;
    }
    // TODO: The PVEvent class should expose a memcopy method
    // that does bound checking instead of having clients reaching
    // for its internal buffer.
    // Clamp the value and complain loudly.
    oscl_memcpy(percentage, buffer, sizeof(int));


    if (*percentage < 0 || *percentage > 100)
    {
        LOGE("Invalid percentage value %d", *percentage);
        return false;
    }
    return true;
}
____________________________________________________________-
log
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)

while play the "http" movie ,it's ok;
and now I don't konw where the percentage is not increasing ,and how
the percentage is increasing.
--~--~---------~--~----~------------~-------~--~----~



Why the buffer is 0 when I play the "rtsp" movie from the internet?

by yjshi » Mon, 31 Aug 2009 19:37:19 GMT


 Why the buffer is 0 when I play the "rtsp" movie from the internet?
I wrote a appliaction to play the movie from the internet.I try many
times and could not found out the reason ,so I decided to have a look
at opencore source code.
I look at the opencore source code ,and I find that it is the most
important code is below.But I could not find out how the percentage is
increasing .So I could not find out where the reason caused all
these.could someone give me a hand?
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€void PlayerDriver::HandleInformationalEvent(const
PVAsyncInformationalEvent& aEvent)
{
......
 case PVMFInfoBufferingStatus:
            {
                const void *buffer = aEvent.GetLocalBuffer();
                const size_t size = aEvent.GetLocalBufferSize();
                int percentage;
                if (GetBufferingPercentage(buffer, size, &percentage))
                {

                    //This place print the log "D/PlayerDriver(   31):
buffering (0)"
                    LOGD("buffering (%d)", percentage);

                    mPvPlayer->sendEvent(MEDIA_BUFFERING_UPDATE,
percentage);
                }
            }
            break;
......

-----------------------------------------------------------------------------------------------------
bool GetBufferingPercentage(const void *buffer,
                            const size_t size,
                            int *percentage)
{
    if (buffer == NULL) {
                LOGI(" GetBufferingPercentage  Invalid buffer: NULL");
                LOGE("Invalid buffer: NULL");
        return false;
    }
    if (sizeof(int) != size)
    {
        LOGE("Invalid percentage buffer size %d (expected %d)", size,
sizeof(int));
        return false;
    }
    // TODO: The PVEvent class should expose a memcopy method
    // that does bound checking instead of having clients reaching
    // for its internal buffer.
    // Clamp the value and complain loudly.
    oscl_memcpy(percentage, buffer, sizeof(int));


    if (*percentage < 0 || *percentage > 100)
    {
        LOGE("Invalid percentage value %d", *percentage);
        return false;
    }
    return true;
}
____________________________________________________________-
log
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)
D/PlayerDriver(   31): buffering (0)

while play the "http" movie ,it's ok;
and now I don't konw where the percentage is not increasing ,and how
the percentage is increasing.
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links